List of usage examples for java.lang System currentTimeMillis
@HotSpotIntrinsicCandidate public static native long currentTimeMillis();
From source file:gov.nist.healthcare.ttt.webapp.api.GetCCDAFolderTest.java
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); JSONObject res = new JSONObject(); HashMap<String, Object> json = new HashMap<>(); String sha = getHTML(/*from w w w .ja v a 2 s . co m*/ "https://api.github.com/repos/siteadmin/2015-Certification-C-CDA-Test-Data/branches/master") .getJSONObject("commit").get("sha").toString(); JSONArray filesArray = getHTML( "https://api.github.com/repos/siteadmin/2015-Certification-C-CDA-Test-Data/git/trees/" + sha + "?recursive=1").getJSONArray("tree"); HashMap<String, Object> resultMap = new HashMap<>(); for (int i = 0; i < filesArray.length(); i++) { JSONObject file = filesArray.getJSONObject(i); if (!files2ignore.contains(file.get("path"))) { // Get path array String[] path = file.get("path").toString().split("/"); // System.out.println(String.join("/", path)); // for(String dir : path) { // if(Pattern.matches(extensionRegex, dir)) { // System.out.println("File!! " + dir); // } // } // json = buildJson2(new HashMap<>(), path, false, true); // resultMap = deepMerge(resultMap, json); // System.out.println(new JSONObject(json).toString(2)); buildJson3(resultMap, path); } } // String[] test = {"test", "retest", "file.txt"}; // json = buildJson2(json, test, false, true); System.out.println(new JSONObject(resultMap).toString(2)); PrintWriter out = new PrintWriter("filename.txt"); out.println(new JSONObject(resultMap).toString(2)); long endTime = System.currentTimeMillis(); long totalTime = endTime - startTime; System.out.println("Running time: " + totalTime / 1000.0 + "s"); // Try download // URL website = new URL("https://raw.githubusercontent.com/siteadmin/2015-Certification-C-CDA-Test-Data/master/Receiver%20SUT%20Test%20Data/170.315_b1_ToC_Amb/170.315_b1_toc_amb_ccd_r11_sample1_v1.xml"); // InputStream strm = website.openStream(); // System.out.println(IOUtils.toString(strm)); }
From source file:UDPTimeServer.java
public static void main(String[] args) throws IOException { int port = 37; ByteBuffer in = ByteBuffer.allocate(8192); ByteBuffer out = ByteBuffer.allocate(8); out.order(ByteOrder.BIG_ENDIAN); SocketAddress address = new InetSocketAddress(port); DatagramChannel channel = DatagramChannel.open(); DatagramSocket socket = channel.socket(); socket.bind(address);/*from w w w . j a v a 2 s . c om*/ System.err.println("bound to " + address); while (true) { try { in.clear(); SocketAddress client = channel.receive(in); System.err.println(client); long secondsSince1970 = System.currentTimeMillis(); out.clear(); out.putLong(secondsSince1970); out.flip(); out.position(4); channel.send(out, client); } catch (Exception ex) { System.err.println(ex); } } }
From source file:Sieve.java
public static void main(String[] s) { int n = 2000000; long start = System.currentTimeMillis(); BitSet b = new BitSet(n + 1); int count = 0; int i;/*from w w w. j av a 2s. c om*/ for (i = 2; i <= n; i++) b.set(i); i = 2; while (i * i <= n) { if (b.get(i)) { count++; int k = 2 * i; while (k <= n) { b.clear(k); k += i; } } i++; } while (i <= n) { if (b.get(i)) count++; i++; } long end = System.currentTimeMillis(); System.out.println(count + " primes"); System.out.println((end - start) + " milliseconds"); }
From source file:org.ala.jms.service.JmsListenerService.java
public static void main(String[] args) throws Exception { long t = System.currentTimeMillis() + 5000; logger.info("Loading ClassPathXmlApplicationContext....... "); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath*:activemq-context.xml"); logger.info("ClassPathXmlApplicationContext: " + context); // delay for pelpop client stating up if (context != null) { while (true) { if (System.currentTimeMillis() > t) { break; }/* w ww .jav a 2 s. c o m*/ } context.start(); logger.info("JMS listener is started!!!"); } }
From source file:gamlss.utilities.ArithmeticSeries.java
public static void main(String[] args) { long t = System.currentTimeMillis(); //ArithmeticSeries.getRep(10, 1000); double[] out = ArithmeticSeries.getSeries(0.11, 142.78, 106.45); System.out.println(out.length); }
From source file:org.transitappliance.loader.LoaderFrontEnd.java
/** * The main CLI of the program. Just loads the config file and spins up Spring. * @param args The command line arguments. Uses varargs so this can be called from a script *///w ww .j a v a 2 s .c o m public static void main(String... args) { // benchmarking long startTime = System.currentTimeMillis(); long totalTime; // Modeled after the main method in OTP Graph Builder // arg checking if (args.length == 0) { System.out.println("usage: loader config.xml"); System.exit(1); } System.out.println("Transit Appliance Stop Loader"); // Load Spring GenericApplicationContext ctx = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx); // Load config file for this agency and database adapter for (String file : args) reader.loadBeanDefinitions(new FileSystemResource(file)); // get the loader, config'd for this agency TransitStopLoader loader = (TransitStopLoader) ctx.getBean("transitStopLoader"); loader.loadStops(); }
From source file:com.test.zmisc.App.java
public static void main(String[] args) { double[] a = new double[32768]; double[] b = new double[32768]; ThreadLocalRandom rand = ThreadLocalRandom.current(); for (int i = 0; i < a.length; i++) { a[i] = rand.nextDouble();//from w w w. j a v a 2 s .c o m b[i] = a[i]; } long ts = System.currentTimeMillis(); PearsonsCorrelation corr = new PearsonsCorrelation(); corr.correlation(a, b); ts = System.currentTimeMillis() - ts; System.out.println("Time elapsed:" + ts + "ms"); // standard deviation is the sqrt(mean((X-avg)^2)) ts = System.currentTimeMillis(); double amean = average(a); double aStdDev = standardDeviation(a, amean); StandardDeviation sd = new StandardDeviation(); sd.setBiasCorrected(false); double bmean = average(b); double bStdDev = standardDeviation(b, bmean); double cor = (covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); ts = System.currentTimeMillis() - ts; System.out.println("Time elapsed:" + ts + "ms"); }
From source file:com.aestel.chemistry.openEye.fp.FPDictionarySorter.java
public static void main(String... args) throws IOException { long start = System.currentTimeMillis(); int iCounter = 0; int fpCounter = 0; // create command line Options object Options options = new Options(); Option opt = new Option("i", true, "input file [.ism,.sdf,...]"); opt.setRequired(true);/* w w w . j ava2 s . co m*/ options.addOption(opt); opt = new Option("fpType", true, "fingerPrintType: maccs|linear7|linear7*4"); opt.setRequired(true); options.addOption(opt); opt = new Option("sampleFract", true, "fraction of input molecules to use (Default=1)"); opt.setRequired(false); options.addOption(opt); CommandLineParser parser = new PosixParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (Exception e) { System.err.println(e.getMessage()); exitWithHelp(options); } args = cmd.getArgs(); if (cmd.hasOption("d")) { System.err.println("Start debugger and press return:"); new BufferedReader(new InputStreamReader(System.in)).readLine(); } if (args.length != 0) { exitWithHelp(options); } String type = cmd.getOptionValue("fpType"); boolean updateDictionaryFile = false; boolean hashUnknownFrag = false; Fingerprinter fprinter = Fingerprinter.createFingerprinter(type, updateDictionaryFile, hashUnknownFrag); OEMolBase mol = new OEGraphMol(); String inFile = cmd.getOptionValue("i"); oemolistream ifs = new oemolistream(inFile); double fract = 2D; String tmp = cmd.getOptionValue("sampleFract"); if (tmp != null) fract = Double.parseDouble(tmp); Random rnd = new Random(); LearningStrcutureCodeMapper mapper = (LearningStrcutureCodeMapper) fprinter.getMapper(); int dictSize = mapper.getMaxIdx() + 1; int[] freq = new int[dictSize]; while (oechem.OEReadMolecule(ifs, mol)) { iCounter++; if (rnd.nextDouble() < fract) { fpCounter++; Fingerprint fp = fprinter.getFingerprint(mol); for (int bit : fp.getBits()) freq[bit]++; } if (iCounter % 100 == 0) System.err.print("."); if (iCounter % 4000 == 0) { System.err.printf(" %d %d %dsec\n", iCounter, fpCounter, (System.currentTimeMillis() - start) / 1000); } } System.err.printf("FPDictionarySorter: Read %d structures calculated %d fprints in %d sec\n", iCounter, fpCounter, (System.currentTimeMillis() - start) / 1000); mapper.reSortDictionary(freq); mapper.writeDictionary(); fprinter.close(); }
From source file:org.apache.cxf.transport.xmpp.pep.Client.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("client-pep-applicationContext.xml"); HelloWorld client = (HelloWorld) context.getBean("helloClient"); long startTime = System.currentTimeMillis(); client.yell("One way message!!!"); System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime)); startTime = System.currentTimeMillis(); client.yell("Second message!!"); System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime)); }
From source file:org.apache.cxf.transport.xmpp.iq.Client.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("client-iq-applicationContext.xml"); HelloWorld client = (HelloWorld) context.getBean("helloClient"); long startTime = System.currentTimeMillis(); String serviceResponse = client.sayHi("XMPP Service Call-1"); System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime)); System.out.println("Service said: " + serviceResponse); startTime = System.currentTimeMillis(); serviceResponse = client.sayHi("XMPP Service Call-2"); System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime)); System.out.println("Service said: " + serviceResponse); }