Java Code Examples for java.lang.Integer#valueOf()

The following examples show how to use java.lang.Integer#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtDirs.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String... args) throws Exception {
    String value = System.getProperty("java.ext.dirs");
    System.out.format("java.ext.dirs = '%s'%n", value);
    if (args.length > 0) {
        int index = Integer.valueOf(args[0]);
        String expectedValue = VALUES[index];
        if (!(expectedValue == value ||
                (value != null && value.isEmpty()) ||
                (expectedValue != null & expectedValue.equals(value)))) {
            throw new RuntimeException("java.ext.dirs (" +
                    value + ") != " + expectedValue);
        }
        // launched by subprocess.
        return;
    }

    if (value != null) {
        throw new RuntimeException("java.ext.dirs not removed: " + value);
    }

    fatalError(0, "-Djava.ext.dirs=foo");
    start(0);
    start(1, "-Djava.ext.dirs=");
    start(2, "-Djava.ext.dirs=\"\"");
}
 
Example 2
Source File: JsonBenchmark.java    From vespa with Apache License 2.0 6 votes vote down vote up
/**
 * jacksons 1000 40000 = 5.6 seconds
 * jacksont 1000 40000 = 11.0 seconds
 * slime 1000 40000  = 17.5 seconds
 * @param argv type, num elements in weigted set, num iterations
 */
static public void main(String argv[]) {
    String type = argv[0];
    byte [] json = createJson(Integer.valueOf(argv[1]));
    warmup(json);
    int count = Integer.valueOf(argv[2]);
    System.out.println(System.currentTimeMillis() + " Start");
    long start = System.currentTimeMillis();
    long numValues;
    if ("jacksons".equals(type)) {
        numValues = benchmarkJacksonStreaming(json, count);
    } else if ("jacksont".equals(type)) {
        numValues = benchmarkJacksonTree(json, count);
    } else{
        numValues = benchmarkSlime(json, count);
    }
    System.out.println(System.currentTimeMillis() + " End with " + numValues + " values in " + (System.currentTimeMillis() - start) + " milliseconds.");
}