Example usage for java.lang Integer MAX_VALUE

List of usage examples for java.lang Integer MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Integer MAX_VALUE.

Prototype

int MAX_VALUE

To view the source code for java.lang Integer MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value an int can have, 231-1.

Usage

From source file:BoxSample.java

private static void changeBoth(JComponent comp) {
    comp.setAlignmentX(Component.CENTER_ALIGNMENT);
    comp.setAlignmentY(Component.CENTER_ALIGNMENT);
    Dimension dim = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    comp.setMaximumSize(dim);//from   w  ww  . j av  a2s  . com
}

From source file:com.google.uzaygezen.core.BoundedRollupTest.java

@Test
public void rootOnly() {
    BoundedRollup<Integer, LongContent> rollup = BoundedRollup.create(TestUtils.ZERO_LONG_CONTENT,
            Integer.MAX_VALUE);
    rollup.feedRow(Iterators.<Integer>emptyIterator(), TestUtils.ONE_LONG_CONTENT);
    MapNode<Integer, LongContent> actual = rollup.finish();
    MapNode<Integer, LongContent> expected = leaf();
    Assert.assertEquals(expected, actual);
}

From source file:com.norconex.commons.lang.time.DurationUtil.java

private static String format(Locale locale, long duration, boolean islong, int maxUnits) {
    int max = Integer.MAX_VALUE;
    if (maxUnits > 0) {
        max = maxUnits;//from ww  w.java2 s  .c  o  m
    }
    long days = duration / DateUtils.MILLIS_PER_DAY;
    long accountedMillis = days * DateUtils.MILLIS_PER_DAY;
    long hours = (duration - accountedMillis) / DateUtils.MILLIS_PER_HOUR;
    accountedMillis += (hours * DateUtils.MILLIS_PER_HOUR);
    long mins = (duration - accountedMillis) / DateUtils.MILLIS_PER_MINUTE;
    accountedMillis += (mins * DateUtils.MILLIS_PER_MINUTE);
    long secs = (duration - accountedMillis) / DateUtils.MILLIS_PER_SECOND;
    StringBuilder b = new StringBuilder();
    int unitCount = 0;
    // days
    if (days > 0) {
        b.append(getString(locale, days, "day", islong));
        unitCount++;
    }
    // hours
    if ((hours > 0 || b.length() > 0) && unitCount < max) {
        b.append(getString(locale, hours, "hour", islong));
        unitCount++;
    }
    // minutes
    if ((mins > 0 || b.length() > 0) && unitCount < max) {
        b.append(getString(locale, mins, "minute", islong));
        unitCount++;
    }
    // seconds
    if (unitCount < max) {
        b.append(getString(locale, secs, "second", islong));
    }
    return b.toString().trim();
}

From source file:edu.berkeley.compbio.sequtils.sequencereader.RandomSectionList.java

@NotNull
public SequenceFragmentMetadata randomSectionFragment() throws NotEnoughSequenceException {
    return new SequenceFragmentMetadata(null, randomName(), null,
            MersenneTwisterFast.randomInt(Integer.MAX_VALUE));
}

From source file:geogebra.common.kernel.statistics.AlgoInversePascal.java

@Override
public final void compute() {

    if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) {
        int param = (int) Math.round(a.getDouble());
        double param2 = b.getDouble();
        double val = c.getDouble();
        try {// w  w  w. j a v  a  2  s . c  om
            PascalDistribution dist = getPascalDistribution(param, param2);

            double result = dist.inverseCumulativeProbability(val);

            // eg InversePascal[1,1,1] returns 2147483647
            if (result >= Integer.MAX_VALUE)
                num.setValue(param);
            else
                num.setValue(result + 1);

        } catch (Exception e) {
            num.setUndefined();
        }
    } else
        num.setUndefined();
}

From source file:com.machinelinking.storage.mongodb.MongoJSONStorageTest.java

@Test
public void testAddGetRemove() throws JSONStorageConnectionException {
    final MongoJSONStorage storage = getStorage();
    final MongoJSONStorageConnection connection = storage.openConnection(TEST_COLLECTION);

    final int id = Integer.MAX_VALUE;
    final String uuid = UUID.randomUUID().toString();
    final String KEY = "rand_uuid";
    final DBObject wData = new BasicDBObject(KEY, uuid);

    connection.addDocument(new MongoDocument(id, 1, "test_rw", wData));
    connection.flush();/*from  w  ww . jav a  2 s. co m*/

    final DBObject rData = connection.getDocument(id).getContent();
    Assert.assertEquals(rData.get(KEY).toString(), uuid);

    connection.removeDocument(id);
    Assert.assertNull(connection.getDocument(id));
}

From source file:org.fcrepo.federation.fedora3.itests.FedoraFederationIT.java

@BeforeClass
public static void ingestTestObjects() throws FedoraClientException, MalformedURLException {
    PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager();
    connectionManager.setMaxTotal(Integer.MAX_VALUE);
    connectionManager.setDefaultMaxPerRoute(5);
    connectionManager.closeIdleConnections(3, TimeUnit.SECONDS);
    client = new DefaultHttpClient(connectionManager);

    String fedoraUrl = "http://localhost:" + System.getProperty("servlet.port") + "/fedora";
    fc = new FedoraClient(new FedoraCredentials(fedoraUrl, "fedoraAdmin", "fc"));

    pid = "it:1";
    ingestFoxml(pid);/*from   w  ww  .jav a 2s. co  m*/
    dsid = "SIMPLE_TEXT";

}

From source file:games.stendhal.server.entity.npc.condition.TextHasNumberCondition.java

/**
 * Creates a new TextHasNumberCondition which checks for a positive integer.
 *
 * @param min minimal accepted number//w w  w . j  a va  2  s  .co m
 */
public TextHasNumberCondition(final int min) {
    this.min = min;
    this.max = Integer.MAX_VALUE;
}

From source file:io.fluo.stress.TrieBasicIT.java

@Test
public void testBit8() throws Exception {
    runTrieTest(25, Integer.MAX_VALUE, 8);
}

From source file:com.github.songsheng.vfs2.provider.nfs.NfsFileRandomAccessContent.java

public NfsFileRandomAccessContent(final XFile NfsFile, final RandomAccessMode mode) throws FileSystemException {
    super(mode);/*  w  w w  .  j a v  a2 s .co m*/

    try {
        raf = new XRandomAccessFile(NfsFile, mode.getModeString());
        rafis = new InputStream() {
            @Override
            public int available() throws IOException {
                final long available = raf.length() - raf.getFilePointer();
                if (available > Integer.MAX_VALUE) {
                    return Integer.MAX_VALUE;
                }

                return (int) available;
            }

            @Override
            public void close() throws IOException {
                raf.close();
            }

            @Override
            public int read() throws IOException {
                return raf.readByte();
            }

            @Override
            public int read(final byte[] b) throws IOException {
                return raf.read(b);
            }

            @Override
            public int read(final byte[] b, final int off, final int len) throws IOException {
                return raf.read(b, off, len);
            }

            @Override
            public long skip(final long n) throws IOException {
                raf.seek(raf.getFilePointer() + n);
                return n;
            }
        };
    } catch (final MalformedURLException e) {
        throw new FileSystemException("vfs.provider/random-access-open-failed.error", NfsFile, e);
    } catch (final UnknownHostException e) {
        throw new FileSystemException("vfs.provider/random-access-open-failed.error", NfsFile, e);
    } catch (IOException e) {
        throw new FileSystemException("vfs.provider/random-access-open-failed.error", NfsFile, e);
    }
}