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:example.rhino.DynamicScopesWithHandlebars.java
private static void runScripts(Context cx, Script script, ExecutorService executor) { ScriptableObject sharedScope = cx.initStandardObjects(null, true); script.exec(cx, sharedScope);// www.j a v a2s. c o m Runnable[] run = new Runnable[NUM_THREAD]; for (int i = 0; i < NUM_THREAD; i++) { String source2 = "Handlebars.precompile(template)"; run[i] = new PerThread(sharedScope, source2, i); } for (int i = 0; i < NUM_THREAD; i++) { executor.execute(run[i]); } executor.shutdown(); try { executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:com.domsplace.DomsCommandsXenforoAddon.Threads.XenforoUpdateThread.java
public XenforoUpdateThread(DomsPlayer who) { super(0, Long.MAX_VALUE, true); this.player = who; }
From source file:Main.java
/** * Returns an exact representation of the <a * href="http://mathworld.wolfram.com/BinomialCoefficient.html"> Binomial * Coefficient</a>, "<code>n choose k</code>", the number of * <code>k</code>-element subsets that can be selected from an * <code>n</code>-element set. * <p>//from w w w .j av a 2 s .c o m * <Strong>Preconditions</strong>: * <ul> * <li> <code>0 <= k <= n </code> (otherwise * <code>IllegalArgumentException</code> is thrown)</li> * <li> The result is small enough to fit into a <code>long</code>. The * largest value of <code>n</code> for which all coefficients are * <code> < Long.MAX_VALUE</code> is 66. If the computed value exceeds * <code>Long.MAX_VALUE</code> an <code>ArithMeticException * </code> is * thrown.</li> * </ul></p> * * @param n the size of the set * @param k the size of the subsets to be counted * @return <code>n choose k</code> * @throws IllegalArgumentException if preconditions are not met. * @throws ArithmeticException if the result is too large to be represented * by a long integer. */ public static long binomialCoefficient(final int n, final int k) { if (n < k) { throw new IllegalArgumentException("must have n >= k for binomial coefficient (n,k)"); } if (n < 0) { throw new IllegalArgumentException("must have n >= 0 for binomial coefficient (n,k)"); } if ((n == k) || (k == 0)) { return 1; } if ((k == 1) || (k == n - 1)) { return n; } long result = Math.round(binomialCoefficientDouble(n, k)); if (result == Long.MAX_VALUE) { throw new ArithmeticException("result too large to represent in a long integer"); } return result; }
From source file:com.vmware.identity.performanceSupport.PerfBucketMetrics.java
/** * Add measurement to the metrics. Thread safe. * * @param value New data entry, >=0/*from w ww . j a v a 2 s . c om*/ */ public synchronized void addMeasurement(long value) { Validate.isTrue(value >= 0, Long.toString(value)); if (Long.MAX_VALUE - totalMs < value) { reset(); //overflow } ++hits; totalMs += value; if (value > ceilingMs) { effectiveCeilingMs = ceilingMs; ceilingMs = value; } else if (value > effectiveCeilingMs) { effectiveCeilingMs = value; } if (value < floorMs) { floorMs = value; } }
From source file:cz.muni.fi.xklinec.zipstream.Utils.java
/** * Reads whole section between current LocalFileHeader and the next Header * from the archive. If the ArchiveEntry being read is deflated, stream * automatically inflates the data. Output is always uncompressed. * //from ww w .j av a2s .com * @param zip * @return * @throws IOException */ public static byte[] readAll(ZipArchiveInputStream zip) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); long skipped = 0; long value = Long.MAX_VALUE; byte[] b = new byte[1024]; while (skipped != value) { long rem = value - skipped; int x = zip.read(b, 0, (int) (b.length > rem ? rem : b.length)); if (x == -1) { return bos.toByteArray(); } bos.write(b, 0, x); skipped += x; } return bos.toByteArray(); }
From source file:info.archinnov.achilles.test.integration.tests.bugs.AllowInsertingStaticColumnWithoutClusteringColumnsIT.java
@Test public void should_insert_only_static_columns() throws Exception { //Given/*from w w w .ja v a2 s .com*/ Long id = RandomUtils.nextLong(0, Long.MAX_VALUE); final ClusteredEntityWithStaticColumn entity = new ClusteredEntityWithStaticColumn(id, null, "city", null); manager.insert(entity); //When final TypedMap found = manager .nativeQuery(select().from(ClusteredEntityWithStaticColumn.TABLE_NAME).where(eq("id", id))) .getFirst(); //Then assertThat(found.getTyped("name")).isNull(); assertThat(found.<String>getTyped("city")).isEqualTo("city"); }
From source file:com.kurento.kmf.test.services.Recorder.java
public static float getPesqMos(String audio, int sampleRate) { float pesqmos = 0; try {// w w w. j a va2 s . c o m String pesq = KurentoServicesTestHelper.getTestFilesPath() + "/bin/pesq/PESQ"; String origWav = ""; if (audio.startsWith(HTTP_TEST_FILES)) { origWav = KurentoServicesTestHelper.getTestFilesPath() + audio.replace(HTTP_TEST_FILES, ""); } else { // Download URL origWav = KurentoMediaServerManager.getWorkspace() + "/downloaded.wav"; URL url = new URL(audio); ReadableByteChannel rbc = Channels.newChannel(url.openStream()); FileOutputStream fos = new FileOutputStream(origWav); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); fos.close(); } Shell.runAndWait(pesq, "+" + sampleRate, origWav, RECORDED_WAV); List<String> lines = FileUtils.readLines(new File(PESQ_RESULTS), "utf-8"); pesqmos = Float.parseFloat(lines.get(1).split("\t")[2].trim()); log.info("PESQMOS " + pesqmos); Shell.runAndWait("rm", PESQ_RESULTS); } catch (IOException e) { log.error("Exception recording local audio", e); } return pesqmos; }
From source file:com.thruzero.test.support.AbstractLinearGrowthPerformanceTestHelper.java
/** Doubling the size should approximately double the time (e.g., O(n)). */ public void execute(final int initialSize, final int numTrials, final float slack) throws Exception { StopWatch timer = new StopWatch(); long previousTime = 0; int currentSize = initialSize; for (int i = 0; i < numTrials; i++) { // since the data doesn't change, the time differences should be a result of garbage collection, system tasks, etc, so try 10 samples and keep the lowest time. long bestTimeAtThisSize = Long.MAX_VALUE; for (int j = 0; j < 10; j++) { doSetup(currentSize);//ww w . ja v a2 s. c o m // perform test with timer timer.start(); doExecute(); timer.stop(); doDataValidation(currentSize); // keep the best time for each sample bestTimeAtThisSize = bestTimeAtThisSize > timer.getTime() ? timer.getTime() : bestTimeAtThisSize; timer.reset(); } // if time is more than double (plus a little slack), then fail the test (subclass defines what fail means - default just prints a warning). String warning = ""; if (previousTime > 0) { if (bestTimeAtThisSize > 2.0f * previousTime + (slack * previousTime)) { warning = handleTimeExceededFail(currentSize); } else if (bestTimeAtThisSize < previousTime) { warning = handleTimeReversalFail(currentSize); } } logger.debug(String.format("##### Time[%5d]: " + bestTimeAtThisSize + "ms" + warning, currentSize)); currentSize *= 2; previousTime = bestTimeAtThisSize; } }
From source file:com.weib.spittr.web.SpittleController.java
@RequestMapping(value = "/spittle_list", method = GET) public List<Spittle> spittles() { return this.spittleRepository.findSpittles(Long.MAX_VALUE, 20); //?? }
From source file:com.redhat.lightblue.query.ValueTest.java
/** * Test of toJson method, of class Value. *///w w w . ja v a 2 s .c om @Test public void testToJson() throws IOException { // if in int range returns IntNode Value instance = new Value(10L); JsonNode expResult = new IntNode(10); JsonNode result = instance.toJson(); assertEquals(expResult, result); instance = new Value(Long.MAX_VALUE); expResult = new LongNode(Long.MAX_VALUE); result = instance.toJson(); assertEquals(expResult, result); instance = new Value(10.0D); expResult = new DoubleNode(10.0D); result = instance.toJson(); assertEquals(expResult, result); instance = new Value(3.0F); expResult = new FloatNode(3.0F); result = instance.toJson(); assertEquals(expResult, result); }