本文整理汇总了Java中org.apache.commons.math.util.MathUtils.round方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.round方法的具体用法?Java MathUtils.round怎么用?Java MathUtils.round使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.util.MathUtils
的用法示例。
在下文中一共展示了MathUtils.round方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFeatureQ3
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
* Get the 3rd quartile of the given Feature of the whole graph.
* @param feature
* @return
*/
public double getFeatureQ3(Feature feature) {
List<Node> nodes = getFeatureSortedNodes(feature, true);
int size = nodes.size();
int q3Position = (int) MathUtils.round((size / 4.0), 0) * 3;
return nodes.get(q3Position).getFeatureValue(feature);
}
示例2: getFeatureQ1
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
* Get the 1st quartile of the given Feature of the whole graph.
* @param feature
* @return
*/
public double getFeatureQ1(Feature feature) {
List<Node> nodes = getFeatureSortedNodes(feature, true);
int size = nodes.size();
int q1Position = (int) MathUtils.round((size / 4.0), 0);
return nodes.get(q1Position).getFeatureValue(feature);
}
示例3: toStringSeparator
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public String toStringSeparator(String separator) {
String string = "";
string += "Key: " + this.key;
string += separator + "Label: " + this.label;
string += separator + "Rank: " + MathUtils.round(this.rank, 2);
string += separator + "Outgoing Edges: " + this.outgoingEdges.size();
string += separator + "Incoming Edges: " + this.incomingEdges.size();
string += separator + "Cooccurrence: " + MathUtils.round(this.cooccurrence, 2);
return string;
}
示例4: toString
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
@Override
public String toString() {
String string = "";
string += "Key: " + this.key;
string += " | Label: " + this.label;
string += " | Rank: " + MathUtils.round(this.rank, 2);
string += " | Outgoing Edges: " + this.outgoingEdges.size();
string += " | Incoming Edges: " + this.incomingEdges.size();
string += " | Cooccurrence: " + MathUtils.round(this.cooccurrence, 2);
return string;
}
示例5: ROUNDDOWN
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public double ROUNDDOWN(double number, int count) {
return MathUtils.round(number, count, BigDecimal.ROUND_DOWN);
}
示例6: ROUNDUP
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public double ROUNDUP(double number, int count) {
return MathUtils.round(number, count, BigDecimal.ROUND_UP);
}
示例7: TRUNC
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public double TRUNC(double number, int count) {
return MathUtils.round(number, count, BigDecimal.ROUND_DOWN);
}
示例8: roundToNextN
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public static double roundToNextN(double value, double n) {
return MathUtils.round(value / n, 0) * n;
}
示例9: ROUND
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
* Rounds the given number to a certain number of decimal places according to valid mathematical criteria. Count
* (optional) is the number of the places to which the value is to be rounded. If the count parameter is negative,
* only the whole number portion is rounded. It is rounded to the place indicated by the count.
*
* @param number
* @return
*/
public double ROUND(double number, int count) {
return MathUtils.round(number, count, BigDecimal.ROUND_FLOOR);
}