List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:Main.java
public static void main(String[] args) { System.out.println("Value = " + Long.valueOf(1234567890987654L)); }
From source file:Main.java
public static void main(String[] args) throws Exception { String str = "0.5"; long l = Long.valueOf(str).longValue(); // or// www .j a v a 2 s .c o m Long L = Long.parseLong(str); }
From source file:Main.java
public static void main(String[] args) { String str = "1234567890987654"; System.out.println("Value = " + Long.valueOf(str)); }
From source file:Main.java
public static void main(String[] args) { Long lObj1 = new Long("100"); System.out.println(lObj1);/* www .j a v a2 s .c o m*/ String str = "100"; Long lObj2 = Long.valueOf(str); System.out.println(lObj2); }
From source file:MainClass.java
public static void main(String args[]) { Boolean bool = Boolean.valueOf("true"); Character c = new Character('c'); Byte b = Byte.valueOf("12"); Short s = Short.valueOf("2"); Integer i = Integer.valueOf("13245"); Long l = Long.valueOf("12341234"); Float f = Float.valueOf("11234.1234"); Double d = Double.valueOf("43213241234.123412341234"); System.out.println(bool);/*from w w w .j a v a 2 s .com*/ System.out.println(c); System.out.println(b); System.out.println(s); System.out.println(i); System.out.println(l); System.out.println(f); System.out.println(d); }
From source file:com.bt.aloha.batchtest.v2.Main.java
public static void main(String[] args) { int res = 256; try {// w ww. j av a 2 s . c o m String appCtx = "com/bt/aloha/batchtest/v2/RobustnessV2.xml"; if (args.length != 0) appCtx = args[0]; // load app context ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(appCtx); // extracts TestRunner TestRunner testRunner = (TestRunner) appContext.getBean("testRunner"); // runs Test Runner ResultTotals resTotal = testRunner.run(); res = Long.valueOf(resTotal.getFailures()).intValue(); LOG.info("Results: " + resTotal); appContext.destroy(); } catch (Throwable t) { LOG.error("Exception cought in Main", t); } LOG.info("Returning code: " + res); if (res != 0) { res = 1; } // return code is calc module 256 System.exit(res); }
From source file:com.example.bigtable.simpleperf.WritePerfTest.java
public static void main(String[] args) throws IOException, InterruptedException { Preconditions.checkArgument(args.length == 6, "Usage: [project id] [zone] [cluster id] [table] [row count] [value size]"); writeTestData(args[0], args[1], args[2], TableName.valueOf(args[3]), Long.valueOf(args[4]), Integer.valueOf(args[5])); }
From source file:com.khartec.waltz.jobs.JooqTest2.java
public static void main(String[] args) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class); DataSource dataSource = ctx.getBean(DataSource.class); DSLContext dsl = DSL.using(dataSource, SQLDialect.POSTGRES_9_4, new Settings().withRenderFormatted(true)); Table<Record> orgTree = table(name("orgTree")); Field<Long> ouIdField = field(name("orgTree", "ouId"), Long.class); SelectJoinStep<Record1<Long>> with = dsl.withRecursive("orgTree", "ouId") .as(select(ORGANISATIONAL_UNIT.ID).from(ORGANISATIONAL_UNIT) .where(ORGANISATIONAL_UNIT.ID.eq(Long.valueOf(210))) .unionAll(select(ORGANISATIONAL_UNIT.ID).from(ORGANISATIONAL_UNIT, orgTree) .where(ORGANISATIONAL_UNIT.PARENT_ID.eq(ouIdField)))) .select(ouIdField).from(orgTree); Field[] fields = new Field[] { APPLICATION.NAME, APPLICATION.ORGANISATIONAL_UNIT_ID, PERSPECTIVE_RATING.CAPABILITY_ID, PERSPECTIVE_RATING.RATING }; String sql = dsl.select(fields).from(PERSPECTIVE_RATING).innerJoin(APPLICATION) .on(PERSPECTIVE_RATING.PARENT_ID.eq(APPLICATION.ID)) .where(PERSPECTIVE_RATING.PERSPECTIVE_CODE.eq("BUSINESS")) .and(APPLICATION.ORGANISATIONAL_UNIT_ID.in(with)).getSQL(); System.out.println(sql);//from w w w .j a v a2s .c o m }
From source file:dk.netarkivet.harvester.tools.CreateIndex.java
/** * The main method that does the parsing of the commandline, and makes the actual index request. * * @param args the arguments/*from ww w .j a v a 2s. c om*/ */ public static void main(String[] args) { Options options = new Options(); CommandLineParser parser = new PosixParser(); CommandLine cmd = null; Option indexType = new Option("t", "type", true, "Type of index"); Option jobList = new Option("l", "jobids", true, "list of jobids"); indexType.setRequired(true); jobList.setRequired(true); options.addOption(indexType); options.addOption(jobList); try { // parse the command line arguments cmd = parser.parse(options, args); } catch (MissingOptionException e) { System.err.println("Some of the required parameters are missing: " + e.getMessage()); dieWithUsage(); } catch (ParseException exp) { System.err.println("Parsing of parameters failed: " + exp.getMessage()); dieWithUsage(); } String typeValue = cmd.getOptionValue(INDEXTYPE_OPTION); String jobidsValue = cmd.getOptionValue(JOBIDS_OPTION); String[] jobidsAsStrings = jobidsValue.split(","); Set<Long> jobIDs = new HashSet<Long>(); for (String idAsString : jobidsAsStrings) { jobIDs.add(Long.valueOf(idAsString)); } JobIndexCache cache = null; String indexTypeAstring = ""; if (typeValue.equalsIgnoreCase("CDX")) { indexTypeAstring = "CDX"; cache = IndexClientFactory.getCDXInstance(); } else if (typeValue.equalsIgnoreCase("DEDUP")) { indexTypeAstring = "DEDUP"; cache = IndexClientFactory.getDedupCrawllogInstance(); } else if (typeValue.equalsIgnoreCase("CRAWLLOG")) { indexTypeAstring = "CRAWLLOG"; cache = IndexClientFactory.getFullCrawllogInstance(); } else { System.err.println("Unknown indextype '" + typeValue + "' requested."); dieWithUsage(); } System.out.println("Creating " + indexTypeAstring + " index for ids: " + jobIDs); Index<Set<Long>> index = cache.getIndex(jobIDs); JMSConnectionFactory.getInstance().cleanup(); }
From source file:com.continuuity.loom.runtime.DummyProvisioner.java
public static void main(final String[] args) throws Exception { Options options = new Options(); options.addOption("h", "host", true, "Loom server to connect to"); options.addOption("p", "port", true, "Loom server port to connect to"); options.addOption("c", "concurrency", true, "default concurrent threads"); options.addOption("f", "failurePercent", true, "% of the time a provisioner should fail its task"); options.addOption("o", "once", false, "whether or not only one task should be taken before exiting"); options.addOption("d", "taskDuration", true, "number of milliseconds it should take to finish a task"); options.addOption("s", "sleepMs", true, "number of milliseconds a thread will sleep before taking another task"); options.addOption("n", "numTasks", true, "number of tasks to try and take from the queue. Default is infinite."); options.addOption("t", "tenant", true, "tenant id to use."); try {//from w w w . ja v a 2s . c om CommandLineParser parser = new BasicParser(); CommandLine cmd = parser.parse(options, args); host = cmd.hasOption('h') ? cmd.getOptionValue('h') : "localhost"; port = cmd.hasOption('p') ? Integer.valueOf(cmd.getOptionValue('p')) : 55054; concurrency = cmd.hasOption('c') ? Integer.valueOf(cmd.getOptionValue('c')) : 5; failurePercent = cmd.hasOption('f') ? Integer.valueOf(cmd.getOptionValue('f')) : 0; runOnce = cmd.hasOption('o'); taskMs = cmd.hasOption('d') ? Long.valueOf(cmd.getOptionValue('d')) : 1000; sleepMs = cmd.hasOption('s') ? Long.valueOf(cmd.getOptionValue('s')) : 1000; numTasks = cmd.hasOption('n') ? Integer.valueOf(cmd.getOptionValue('n')) : -1; tenant = cmd.hasOption('t') ? cmd.getOptionValue('t') : "loom"; } catch (ParseException e) { LOG.error("exception parsing input arguments.", e); return; } if (concurrency < 1) { LOG.error("invalid concurrency level {}.", concurrency); return; } if (runOnce) { new Provisioner("dummy-0", tenant, host, port, failurePercent, taskMs, sleepMs, 1).runOnce(); } else { LOG.info(String.format( "running with %d threads, connecting to %s:%d using tenant %s, with a failure rate of" + "%d percent, task time of %d ms, and sleep time of %d ms between fetches", concurrency, host, port, tenant, failurePercent, taskMs, sleepMs)); pool = Executors.newFixedThreadPool(concurrency); try { int tasksPerProvisioner = numTasks >= 0 ? numTasks / concurrency : -1; int extra = numTasks < 0 ? 0 : numTasks % concurrency; pool.execute(new Provisioner("dummy-0", tenant, host, port, failurePercent, taskMs, sleepMs, tasksPerProvisioner + extra)); for (int i = 1; i < concurrency; i++) { pool.execute(new Provisioner("dummy-" + i, tenant, host, port, failurePercent, taskMs, sleepMs, tasksPerProvisioner)); } } catch (Exception e) { LOG.error("Caught exception, shutting down now.", e); pool.shutdownNow(); } pool.shutdown(); } }