当前位置: 首页>>代码示例>>Java>>正文


Java FloatingDecimal.appendTo方法代码示例

本文整理汇总了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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:TestFloatingDecimal.java

示例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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:TestFloatingDecimal.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:AbstractStringBuilder.java


注:本文中的sun.misc.FloatingDecimal.appendTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。