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:id.zelory.tanipedia.util.Utils.java

public static boolean isMyServiceRunning(Class<?> serviceClass, Context context) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClass.getName().equals(service.service.getClassName())) {
            return true;
        }//from www.  ja v  a  2s .  c om
    }
    return false;
}

From source file:com.milaboratory.core.io.util.IOUtilTest.java

@Test
public void test1() throws Exception {
    RandomGenerator rg = new Well19937a();

    int count = 1000;
    int[] values = new int[count];

    for (int n = 0; n < 10; ++n) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        for (int i = 0; i < count; ++i) {
            final int d = rg.nextInt(31);
            values[i] = (rg.nextInt(Integer.MAX_VALUE) >>> d);
            IOUtil.writeRawVarint32(bos, values[i]);
        }//  ww w  .j  av  a2 s .co  m

        byte[] data = bos.toByteArray();

        ByteArrayInputStream bis = new ByteArrayInputStream(data);
        int g;
        for (int i = 0; i < count; ++i) {
            Assert.assertEquals(values[i], IOUtil.readRawVarint32(bis, -1));
        }
        Assert.assertEquals(-1, IOUtil.readRawVarint32(bis, -1));
    }
}

From source file:uk.co.threeonefour.ifictionary.svc.GameServiceImpl.java

@Transactional
public List<GameInfo> listGames() {
    List<GameInfo> games = gameInfoDao.list(0, Integer.MAX_VALUE);
    return games;
}

From source file:org.jasig.portlet.survey.service.report.DefaultSurveyReportGenerator.java

@Override
public int getPriority() {
    // Always last
    return Integer.MAX_VALUE;
}

From source file:cz.jirutka.validator.collection.internal.HibernateValidatorInfo.java

/**
 * Returns version of the Hibernate Validator determined from the package
 * info on classpath.//ww  w.ja  va2s. c  o m
 *
 * <p>Version number is parsed as: 5.1.1.Final -> 511, 5.2.0-SNAPSHOT -> 520.</p>
 *
 * @return A parsed version number, or {@link Integer#MAX_VALUE} if could not be determined.
 */
public static int getVersion() {

    Package pkg = HibernateValidator.class.getPackage();

    if (pkg != null) {
        String version = pkg.getImplementationVersion();
        String title = pkg.getImplementationTitle();

        if (isNotEmpty(version) && "hibernate-validator".equals(title)) {
            LOG.info("Found Hibernate Validator {}", version);
            return parseVersion(version);
        }
    }
    LOG.warn("Could not determine Hibernate Validator version");
    return Integer.MAX_VALUE;
}

From source file:geogebra.kernel.statistics.AlgoInversePoisson.java

protected final void compute() {

    if (input[0].isDefined() && input[1].isDefined()) {
        double param = a.getDouble();
        double val = b.getDouble();
        try {/*from   www .j  a va  2 s. c om*/
            PoissonDistribution dist = getPoissonDistribution(param);

            double result = dist.inverseCumulativeProbability(val);

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

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

From source file:org.pdfsam.ui.info.InfoStageController.java

@EventListener(priority = Integer.MAX_VALUE)
@SuppressWarnings("unused")
void requestShow(ShowPdfDescriptorRequest event) {
    InfoStage stage = applicationContext.getBean(InfoStage.class);
    if (!stage.isShowing()) {
        stage.centerOnScreen();/*  ww  w .j  av a 2  s . c o  m*/
        stage.show();
    }
    stage.requestFocus();
}

From source file:edu.oregonstate.eecs.mcplan.domains.planetwars.PwGame.java

public static PwGame PlanetWarsBasic(final RandomGenerator rng) {
    final ArrayList<PwUnit> units = new ArrayList<PwUnit>();
    for (final PwA_Units ut : PwA_Units.values()) {
        units.add(ut.u);/*from   w w  w  .j a  va 2s  .c om*/
    }

    final int T = 200;
    final int epoch = 1;
    final int max_population = 1000;
    final int planet_capacity = Integer.MAX_VALUE;
    final int[] starting_units = new int[] { 10 };

    return new PwGame(rng, T, epoch, units, max_population, planet_capacity, starting_units,
            new PwA_ActionGenerator());
}

From source file:de.blizzy.documentr.markdown.macro.impl.TableOfContentsMacro.java

@Override
String getMarkdown(IMacroContext macroContext) {
    HtmlSerializerContext context = macroContext.getHtmlSerializerContext();
    List<Header> headers = context.getHeaders();
    if (!headers.isEmpty()) {
        int smallestLevel = Integer.MAX_VALUE;
        for (Header header : headers) {
            int level = header.getLevel() - 1;
            if (level < smallestLevel) {
                smallestLevel = level;/*w w  w  .j av a 2  s .com*/
            }
        }

        StringBuilder buf = new StringBuilder();
        for (Header header : headers) {
            buf.append(StringUtils.repeat("    ", header.getLevel() - 1 - smallestLevel)) //$NON-NLS-1$
                    .append("- [[#").append(header.getText()).append("]]\n"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        return buf.toString() + "\n"; //$NON-NLS-1$
    }
    return null;
}

From source file:kobic.msb.swing.comparator.JMsbComparatorChain.java

@SuppressWarnings("unchecked")
public int compare(Object o1, Object o2) throws UnsupportedOperationException {
    if (isLocked == false) {
        this.checkChainIntegrity();
        isLocked = true;/*from  w  w w  .j  a v a  2  s  . c om*/
    }

    // iterate over all comparators in the chain
    Iterator comparators = comparatorChain.iterator();
    for (int comparatorIndex = 0; comparators.hasNext(); ++comparatorIndex) {

        Comparator comparator = (Comparator) comparators.next();
        int retval = comparator.compare(o1, o2);
        if (retval != 0) {
            // invert the order if it is a reverse sort
            if (orderingBits.get(comparatorIndex) == true) {
                if (Integer.MIN_VALUE == retval) {
                    retval = Integer.MAX_VALUE;
                } else {
                    retval *= -1;
                }
            }

            return retval;
        }
    }

    // if comparators are exhausted, return 0
    return 0;
}