List of usage examples for java.lang Long MAX_VALUE
long MAX_VALUE
To view the source code for java.lang Long MAX_VALUE.
Click Source Link
From source file:UUIDGenerator.java
/** * MD5 a random string with localhost/date etc will return 128 bits * construct a string of 18 characters from those bits. * * @return string/*from w w w.j a va 2s . c om*/ */ public static String getUUID() { if (baseUUID == null) { getInitialUUID(); } long i = ++incrementingValue; if (i >= Long.MAX_VALUE || i < 0) { incrementingValue = 0; i = 0; } return baseUUID + System.currentTimeMillis() + i; }
From source file:Main.java
public static void shutdownNow(ExecutorService exec) { if (exec != null) { List<Runnable> tasks = exec.shutdownNow(); if (tasks.size() == 0) { System.out.println(//from w w w . j a v a 2 s. co m "Runnable tasks outlived thread pool executor service [" + ", tasks=" + tasks + ']'); } try { exec.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { System.out.println( "Got interrupted while waiting for executor service to stop.[" + e.toString() + "]"); } } }
From source file:com.l2jfree.util.concurrent.ExecuteWrapper.java
public static void execute(Runnable runnable) { execute(runnable, Long.MAX_VALUE); }
From source file:io.realm.TestHelper.java
public static SyncUser createTestUser() { return createTestUser(Long.MAX_VALUE); }
From source file:net.infstudio.inflauncher.game.downloading.URLConnectionTimer.java
public static long testTime(String url) { try {// w w w . j av a 2s. co m HttpClient client = HttpClientBuilder.create().build(); HttpUriRequest request = RequestBuilder.get(url).build(); long start = System.currentTimeMillis(); client.execute(request); long end = System.currentTimeMillis(); return end - start; } catch (IOException e) { InfinityDownloader.logger.error(e); return Long.MAX_VALUE; } }
From source file:annis.utils.Utils.java
public static String min(List<Long> runtimeList) { long min = Long.MAX_VALUE; for (long value : runtimeList) { min = Math.min(min, value); }//from w w w .j a va 2 s .c o m return String.valueOf(min); }
From source file:SimpleLongIdGenerator.java
/** * Creates a new default cycled id generator. Starts from 1 and counts up to max long value. */ public SimpleLongIdGenerator() { this(1, Long.MAX_VALUE, true); }
From source file:Main.java
/** * Multiply two long integers, checking for overflow. * /*from ww w . j av a 2 s .com*/ * @param a first value * @param b second value * @return the product <code>a * b</code> * @throws ArithmeticException if the result can not be represented as an * long * @since 1.2 */ public static long mulAndCheck(long a, long b) { long ret; String msg = "overflow: multiply"; if (a > b) { // use symmetry to reduce boundry cases ret = mulAndCheck(b, a); } else { if (a < 0) { if (b < 0) { // check for positive overflow with negative a, negative b if (a >= Long.MAX_VALUE / b) { ret = a * b; } else { throw new ArithmeticException(msg); } } else if (b > 0) { // check for negative overflow with negative a, positive b if (Long.MIN_VALUE / b <= a) { ret = a * b; } else { throw new ArithmeticException(msg); } } else { // assert b == 0 ret = 0; } } else if (a > 0) { // assert a > 0 // assert b > 0 // check for positive overflow with positive a, positive b if (a <= Long.MAX_VALUE / b) { ret = a * b; } else { throw new ArithmeticException(msg); } } else { // assert a == 0 ret = 0; } } return ret; }
From source file:de.blizzy.documentr.TestUtil.java
public static Page createRandomPage(String parentPagePath) { Page page = Page.fromText(String.valueOf(Math.random() * Long.MAX_VALUE), String.valueOf(Math.random() * Long.MAX_VALUE)); TestPageUtil.setParentPagePath(page, parentPagePath); return page;//from w w w . java2 s . com }
From source file:gov.nih.nci.cabig.caaers.utils.DateUtils.java
/** * Will return the difference in days between the two dates * @param d1// ww w . j av a2 s . c o m * @param d2 * @return */ public static long differenceInDays(Date d1, Date d2) { if (d1 == null || d2 == null) return Long.MAX_VALUE; long l1 = d1.getTime(); long l2 = d2.getTime(); return (l1 - l2) / (1000 * 60 * 60 * 24); }