List of usage examples for java.lang System currentTimeMillis
@HotSpotIntrinsicCandidate public static native long currentTimeMillis();
From source file:org.bigtextml.drivers.BigMapReadTest.java
public static void main(String[] args) { /*//from ww w. j a va 2 s .com ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"InMemoryDataMining.xml"}); */ System.out.println(System.getProperty("InvokedFromSpring")); //Map<String,List<Integer>> bm = context.getBean("bigMapTest",BigMap.class); Map<String, List<Integer>> bm = ManagementServices.getBigMap("tmCache"); System.out.println(((BigMap) bm).getCacheName()); int max = 1000000; String key = Integer.toString(max - 1); //bm.remove(key); for (int i = 0; i < 3; i++) { long millis = System.currentTimeMillis(); System.out.println(bm.get(Integer.toString(500000))); System.out.println(System.currentTimeMillis() - millis); } bm.clear(); }
From source file:com.aestel.chemistry.openEye.fp.DistMatrix.java
public static void main(String... args) throws IOException { long start = System.currentTimeMillis(); // create command line Options object Options options = new Options(); Option opt = new Option("i", true, "input file [.tsv from FingerPrinter]"); opt.setRequired(true);/*from w w w. j a v a 2 s .c o m*/ options.addOption(opt); opt = new Option("o", true, "outpur file [.tsv "); opt.setRequired(true); 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 (args.length != 0) exitWithHelp(options); String file = cmd.getOptionValue("i"); BufferedReader in = new BufferedReader(new FileReader(file)); file = cmd.getOptionValue("o"); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file))); ArrayList<Fingerprint> fps = new ArrayList<Fingerprint>(); ArrayList<String> ids = new ArrayList<String>(); String line; while ((line = in.readLine()) != null) { String[] parts = line.split("\t"); if (parts.length == 3) { ids.add(parts[0]); fps.add(new ByteFingerprint(parts[2])); } } in.close(); out.print("ID"); for (int i = 0; i < ids.size(); i++) { out.print('\t'); out.print(ids.get(i)); } out.println(); for (int i = 0; i < ids.size(); i++) { out.print(ids.get(i)); Fingerprint fp1 = fps.get(i); for (int j = 0; j <= i; j++) { out.printf("\t%.4g", fp1.tanimoto(fps.get(j))); } out.println(); } out.close(); System.err.printf("Done %d fingerprints in %.2gsec\n", fps.size(), (System.currentTimeMillis() - start) / 1000D); }
From source file:org.eclipse.swt.snippets.Snippet275.java
public static void main(String[] args) { final int INTERVAL = 888; final Display display = new Display(); final Image image = new Image(display, 750, 750); GC gc = new GC(image); gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); gc.fillRectangle(image.getBounds()); gc.dispose();// w w w . j a va2 s. c o m Shell shell = new Shell(display); shell.setText("Snippet 275"); shell.setBounds(10, 10, 790, 790); final Canvas canvas = new Canvas(shell, SWT.NONE); canvas.setBounds(10, 10, 750, 750); canvas.addListener(SWT.Paint, event -> { value = String.valueOf(System.currentTimeMillis()); event.gc.drawImage(image, 0, 0); event.gc.drawString(value, 10, 10, true); }); display.timerExec(INTERVAL, new Runnable() { @Override public void run() { if (canvas.isDisposed()) return; // canvas.redraw (); // <-- bad, damages more than is needed GC gc = new GC(canvas); Point extent = gc.stringExtent(value + '0'); gc.dispose(); canvas.redraw(10, 10, extent.x, extent.y, false); display.timerExec(INTERVAL, this); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } image.dispose(); display.dispose(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String driverName = "com.jnetdirect.jsql.JSQLDriver"; Class.forName(driverName);/* w ww . j av a2 s . co m*/ String serverName = "127.0.0.1"; String portNumber = "1433"; String mydatabase = serverName + ":" + portNumber; String url = "jdbc:JSQLConnect://" + mydatabase; String username = "username"; String password = "password"; Connection connection = DriverManager.getConnection(url, username, password); String sql = "INSERT INTO mysql_all_table(" + "col_boolean," + "col_byte," + "col_short," + "col_int," + "col_long," + "col_float," + "col_double," + "col_bigdecimal," + "col_string," + "col_date," + "col_time," + "col_timestamp," + "col_asciistream," + "col_binarystream," + "col_blob) " + "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; PreparedStatement pstmt = connection.prepareStatement(sql); pstmt.setBoolean(1, true); pstmt.setByte(2, (byte) 123); pstmt.setShort(3, (short) 123); pstmt.setInt(4, 123); pstmt.setLong(5, 123L); pstmt.setFloat(6, 1.23F); pstmt.setDouble(7, 1.23D); pstmt.setBigDecimal(8, new BigDecimal(1.23)); pstmt.setString(9, "a string"); pstmt.setDate(10, new java.sql.Date(System.currentTimeMillis())); pstmt.setTime(11, new Time(System.currentTimeMillis())); pstmt.setTimestamp(12, new Timestamp(System.currentTimeMillis())); File file = new File("infilename1"); FileInputStream is = new FileInputStream(file); pstmt.setAsciiStream(13, is, (int) file.length()); file = new File("infilename2"); is = new FileInputStream(file); pstmt.setBinaryStream(14, is, (int) file.length()); file = new File("infilename3"); is = new FileInputStream(file); pstmt.setBinaryStream(15, is, (int) file.length()); pstmt.executeUpdate(); }
From source file:europarl.Main.java
public static void main(String[] args) { //GLOBAL OPTIONS String target_word = new String("plane"); for (String arg : args) { if (arg.startsWith("-")) { } else {//from w w w.j a va 2 s. co m target_word = arg; } } if (!Cfg.load_config("config/configuration.properties")) return; WordAlignment align = new WordAlignment(); long startTime = System.currentTimeMillis(); align.setStemmer(new SnowballStemmer("english")); align.getFromGz("data/it-en.A3.final.gz", target_word, -1); long endTime = System.currentTimeMillis(); Main.log.info("Read in " + (endTime - startTime) / 1000.0 + " seconds"); align.print(); startTime = System.currentTimeMillis(); endTime = System.currentTimeMillis(); Main.log.info("Converted n " + (endTime - startTime) / 1000.0 + " seconds"); align.saveToArff("./data/dataset_" + target_word + ".arff"); return; }
From source file:com.datumbox.opensource.examples.DPMMExample.java
/** * @param args the command line arguments *//*w w w . j a va 2 s . c om*/ public static void main(String[] args) { long startTime = System.currentTimeMillis(); GDPMM(); System.out.println(); MDPMM(); long stopTime = System.currentTimeMillis(); long elapsedTime = stopTime - startTime; System.out.println("Completed in " + String.valueOf(elapsedTime / 1000.0) + " sec"); }
From source file:com.sm.test.TestClient.java
public static void main(String[] args) { ccf = ClusterClientFactory.connect(HOST_CONNECT_URL, STORENAME); client = ccf.getDefaultStore();//from ww w . j a v a 2 s . c o m while (true) { try { long time = System.currentTimeMillis() / 1000; ByteArrayConverter converter = new ByteArrayConverter(); Key<ByteArray> key = Key.createKey(new ByteArray("1.abcdef".getBytes())); Bar bar = new Bar(); client.put(key, new ByteArray("FooBar".getBytes())); Value<ByteArray> value = client.get(key); System.out.println("" + new String(value.getData().get())); try { Thread.sleep(3000L); } catch (InterruptedException e) { e.printStackTrace(); } } catch (Exception ex) { System.out.println(ex.getMessage()); } if (false) break; } client.close(); ccf.close(); }
From source file:Snippet144.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new RowLayout(SWT.VERTICAL)); final Table table = new Table(shell, SWT.VIRTUAL | SWT.BORDER); table.addListener(SWT.SetData, new Listener() { public void handleEvent(Event event) { TableItem item = (TableItem) event.item; int index = table.indexOf(item); item.setText("Item " + index); System.out.println(item.getText()); }/*from w ww. ja v a2 s . c om*/ }); table.setLayoutData(new RowData(200, 200)); Button button = new Button(shell, SWT.PUSH); button.setText("Add Items"); final Label label = new Label(shell, SWT.NONE); button.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { long t1 = System.currentTimeMillis(); table.setItemCount(COUNT); long t2 = System.currentTimeMillis(); label.setText("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms)"); shell.layout(); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:SageCollegeProject.guideBox.java
public static void main(String[] args) throws MalformedURLException, IOException, URISyntaxException { Long t = System.currentTimeMillis(); GetShowPoster("2097"); System.out.println(System.currentTimeMillis() - t); }
From source file:module.entities.NameFinder.RegexNameFinder.java
/** * @param args the command line arguments *///from ww w . jav a2 s . com public static void main(String[] args) throws SQLException, IOException { if (args.length == 1) { Config.configFile = args[0]; } long lStartTime = System.currentTimeMillis(); Timestamp startTime = new Timestamp(lStartTime); System.out.println("Regex Name Finder process started at: " + startTime); DB.initPostgres(); regexerId = DB.LogRegexFinder(lStartTime); initLexicons(); JSONObject obj = new JSONObject(); TreeMap<Integer, String> consultations = DB.getDemocracitConsultationBody(); Document doc; int count = 0; TreeMap<Integer, String> consFoundNames = new TreeMap<>(); TreeMap<Integer, String> consFoundRoles = new TreeMap<>(); for (int consId : consultations.keySet()) { String consBody = consultations.get(consId); String signName = "", roleName = ""; doc = Jsoup.parse(consBody); Elements allPars = new Elements(); Elements paragraphs = doc.select("p"); for (Element par : paragraphs) { if (par.html().contains("<br>")) { String out = "<p>" + par.html().replaceAll("<br>", "</p><p>") + "</p>"; Document internal_doc = Jsoup.parse(out); Elements subparagraphs = internal_doc.select("p"); allPars.addAll(subparagraphs); } else { allPars.add(par); } // System.out.println(formatedText); } String signature = getSignatureFromParagraphs(allPars); // System.out.println(signature); if (signature.contains("#")) { String[] sign_tokens = signature.split("#"); signName = sign_tokens[0]; if (sign_tokens.length > 1) { roleName = sign_tokens[1]; } consFoundNames.put(consId, signName.trim()); consFoundRoles.put(consId, roleName.trim()); count++; } else { System.err.println("--" + consId); } // } DB.insertDemocracitConsultationMinister(consFoundNames, consFoundRoles); TreeMap<Integer, String> consultationsCompletedText = DB.getDemocracitCompletedConsultationBody(); Document doc2; TreeMap<Integer, String> complConsFoundNames = new TreeMap<>(); int count2 = 0; for (int consId : consultationsCompletedText.keySet()) { String consBody = consultationsCompletedText.get(consId); String signName = "", roleName = ""; doc2 = Jsoup.parse(consBody); // if (doc.text().contains("<br>")) { // doc.text().replaceAll("(<[Bb][Rr]>)+", "<p>"); // } Elements allPars = new Elements(); Elements paragraphs = doc2.select("p"); for (Element par : paragraphs) { if (par.html().contains("<br>")) { String out = "<p>" + par.html().replaceAll("<br>", "</p><p>") + "</p>"; Document internal_doc = Jsoup.parse(out); Elements subparagraphs = internal_doc.select("p"); allPars.addAll(subparagraphs); } else { allPars.add(par); } } String signature = getSignatureFromParagraphs(allPars); if (signature.contains("#")) { String[] sign_tokens = signature.split("#"); signName = sign_tokens[0]; if (sign_tokens.length > 1) { roleName = sign_tokens[1]; } consFoundNames.put(consId, signName.trim()); consFoundRoles.put(consId, roleName.trim()); // System.out.println(consId); // System.out.println(signName.trim()); // System.out.println("***************"); count2++; } else { System.err.println("++" + consId); } } DB.insertDemocracitConsultationMinister(complConsFoundNames, consFoundRoles); long lEndTime = System.currentTimeMillis(); System.out.println("Regex Name Finder process finished at: " + startTime); obj.put("message", "Regex Name Finder finished with no errors"); obj.put("details", ""); DB.UpdateLogRegexFinder(lEndTime, regexerId, obj); DB.close(); }