本文整理汇总了Java中sun.misc.FloatingDecimal.appendTo方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingDecimal.appendTo方法的具体用法?Java FloatingDecimal.appendTo怎么用?Java FloatingDecimal.appendTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.misc.FloatingDecimal
的用法示例。
在下文中一共展示了FloatingDecimal.appendTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAppendToDouble
import sun.misc.FloatingDecimal; //导入方法依赖的package包/类
private static int testAppendToDouble() {
System.out.println(" testAppendToDouble");
int failures = 0;
for(int i = 0; i < NUM_RANDOM_TESTS; i++) {
double[] d = new double[] {
RANDOM.nextLong(),
RANDOM.nextGaussian(),
RANDOM.nextDouble()*Double.MAX_VALUE
};
for(int j = 0; j < d.length; j++) {
OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]);
StringBuilder sb = new StringBuilder();
ofd.appendTo(sb);
String oldString = sb.toString();
sb = new StringBuilder();
FloatingDecimal.appendTo(d[j], sb);
String newString = sb.toString();
failures += check("testAppendToDouble", oldString, newString);
}
}
return failures;
}
示例2: testAppendToFloat
import sun.misc.FloatingDecimal; //导入方法依赖的package包/类
private static int testAppendToFloat() {
System.out.println(" testAppendToFloat");
int failures = 0;
for(int i = 0; i < NUM_RANDOM_TESTS; i++) {
float[] f = new float[] {
RANDOM.nextLong(),
(float)RANDOM.nextGaussian(),
RANDOM.nextFloat()*Float.MAX_VALUE
};
for(int j = 0; j < f.length; j++) {
OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]);
StringBuilder sb = new StringBuilder();
ofd.appendTo(sb);
String oldString = sb.toString();
sb = new StringBuilder();
FloatingDecimal.appendTo(f[j], sb);
String newString = sb.toString();
failures += check("testAppendToFloat", oldString, newString);
}
}
return failures;
}
示例3: append
import sun.misc.FloatingDecimal; //导入方法依赖的package包/类
/**
* Appends the string representation of the {@code float}
* argument to this sequence.
* <p>
* The overall effect is exactly as if the argument were converted
* to a string by the method {@link String#valueOf(float)},
* and the characters of that string were then
* {@link #append(String) appended} to this character sequence.
*
* @param f a {@code float}.
* @return a reference to this object.
*/
public AbstractStringBuilder append(float f) {
FloatingDecimal.appendTo(f,this);
return this;
}