Example usage for java.lang Long MAX_VALUE

List of usage examples for java.lang Long MAX_VALUE

Introduction

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

Prototype

long MAX_VALUE

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

Click Source Link

Document

A constant holding the maximum value a long can have, 263-1.

Usage

From source file:gov.nih.nci.cabig.caaers.utils.DateUtils.java

/**
 * Will return the difference in minutes between the two dates
 * @param d1/*  w w w  . j  a  v a  2 s .c  o m*/
 * @param d2
 * @return
 */
public static long differenceInMinutes(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);
}

From source file:com.twinsoft.convertigo.engine.util.CookiesUtils.java

public static void addCookie(HttpState httpState, String cook) {
    String name = "";
    String domain = "";
    String path = "";
    String value = "";
    boolean secure = false;
    Date expires = new Date(Long.MAX_VALUE);

    String[] fields = cook.split(";");
    for (int i = 0; i < fields.length; i++) {
        String[] half = fields[i].trim().split("=");
        if (half.length == 2) {
            if (fields[i].startsWith("$")) {
                if (half[0].equals("$Domain"))
                    domain = half[1];//from w w w  .ja v  a  2  s  . c  om
                else if (half[0].equals("$Path"))
                    path = half[1];
                else if (half[0].equals("$Secure"))
                    secure = Boolean.getBoolean(half[1]);
                else if (half[0].equals("$Date"))
                    try {
                        expires = DateFormat.getDateTimeInstance().parse(half[1]);
                    } catch (ParseException e) {
                    }
            } else {
                name = half[0];
                value = half[1];
            }
        }
    }

    Cookie cookie = null;
    try {
        cookie = new Cookie(domain, name, value, path, expires, secure);
        if (cookie != null)
            httpState.addCookie(cookie);
    } catch (Exception e) {
        Engine.logBeans.debug("(CookiesUtils) failed to parse cookie: " + cook);
    }
}

From source file:lirmm.inria.fr.math.OpenLongToDoubleHashMapTest.java

@Before
public void setUp() throws Exception {
    javaMap.put(Long.valueOf(50), 100.0);
    javaMap.put(Long.valueOf(75), 75.0);
    javaMap.put(Long.valueOf(25), 500.0);
    javaMap.put(Long.MAX_VALUE, Double.MAX_VALUE);
    javaMap.put(Long.valueOf(0), -1.0);
    javaMap.put(Long.valueOf(1), 0.0);
    javaMap.put(Long.valueOf(33), -0.1);
    javaMap.put(Long.valueOf(23234234), -242343.0);
    javaMap.put(Long.valueOf(23321), Double.MIN_VALUE);
    javaMap.put(Long.valueOf(-4444), 332.0);
    javaMap.put(Long.valueOf(-1), -2323.0);
    javaMap.put(Long.MIN_VALUE, 44.0);
    javaMap.put(Long.valueOf("7263934625316938832"), 224.0);

    /* Add a few more to cause the table to rehash */
    javaMap.putAll(generate());/*from  www.j a v  a 2 s .  c  o  m*/

}

From source file:com.livhuwani.rambuda.policyquotationapp.services.Impl.PolicyQuoteCrudServiceImpl.java

@Override
public PolicyQuote createPolicyQuotes(Person person, Policy policy) {
    PolicyQuote quote = new PolicyQuote();
    quote.setId(Long.MAX_VALUE + 1);
    quote.setPerson(person);/*from  w ww  .  j av  a  2  s . c  om*/
    quote.setPolicy(policy);
    quote.setQuoteAmount(BigDecimal.valueOf(3200));
    quote.setQuoteStatus(Boolean.TRUE);
    quote.setQuoteDate(new Date());

    PolicyQuote savedQuote = policyQuoteRepository.saveAndFlush(quote);
    return savedQuote;
}

From source file:de.csdev.ebus.command.datatypes.std.AbstractEBusTypeUnsignedNumber.java

@Override
public byte[] encodeInt(Object data) throws EBusTypeException {

    BigDecimal b = NumberUtils.toBigDecimal(data == null ? 0 : data);
    long l = b.longValue() & Long.MAX_VALUE;

    int length = getTypeLength();
    byte[] result = new byte[length];
    for (int i = 0; i <= length - 1; i++) {
        result[i] = (byte) (l & 0xFF);
        l >>= 8;//from w w w . ja v  a2  s  . c om
    }

    return result;
}

From source file:edu.infsci2560.models.Certification.java

public Certification() {
    this.id = Long.MAX_VALUE;
    this.certificationName = null;
    this.certificationType = null;
    // this.certificationOrgnizor = CertificationOrgnizor.Cisco;
    this.certificationOrgnizor = null;
}

From source file:livhuwani.rambuda.policy_app.services.Impl.PolicyCrudServiceImpl.java

@Override
public Policy createBusinessPolicy(BusinessInterest type) {
    Policy policy = new Policy();
    policy.setId(Long.MAX_VALUE + 1);
    policy.setDescription("Businss Policy");
    policy.setOwnership("100");
    policy.setPolicyNumber("2154635");
    policy.setPolicyValue(BigDecimal.valueOf(1500000));
    policy.setTouchDate(DateTime.now());
    policy.getPolicyType().setBusinessInterest(type);

    Policy savedPolicy = policyRepository.saveAndFlush(policy);
    return savedPolicy;
}

From source file:jetbrains.exodus.gc.CleanWholeLogJob.java

@Override
protected void execute() throws Throwable {
    info("CleanWholeLogJob started");
    try {//from ww  w.jav a  2 s.  co m
        final Log log = gc.getLog();
        long lastNumberOfFiles = Long.MAX_VALUE;
        long numberOfFiles;
        // repeat cleaning until number of files stops decreasing
        while ((numberOfFiles = log.getNumberOfFiles()) != 1 && numberOfFiles < lastNumberOfFiles) {
            lastNumberOfFiles = numberOfFiles;
            final long highFileAddress = log.getHighFileAddress();
            long fileAddress = log.getLowAddress();
            while (fileAddress != highFileAddress) {
                gc.cleanFile(fileAddress);
                fileAddress = log.getNextFileAddress(fileAddress);
            }
            gc.testDeletePendingFiles();
        }
    } finally {
        release();
        info("CleanWholeLogJob finished");
    }
}

From source file:CountingOutputStream.java

public long getCount() {
    if (count >= 0 && count <= Long.MAX_VALUE) {
        return count;
    }// w w  w . jav a2 s.  c o  m
    throw new IllegalStateException("out bytes exceeds Long.MAX_VALUE: " + count);
}

From source file:org.esigate.cache.CacheConfigHelper.java

public static CacheConfig createCacheConfig(Properties properties) {

    // Heuristic caching
    boolean heuristicCachingEnabled = Parameters.HEURISTIC_CACHING_ENABLED.getValue(properties);
    float heuristicCoefficient = Parameters.HEURISTIC_COEFFICIENT.getValue(properties);
    long heuristicDefaultLifetimeSecs = Parameters.HEURISTIC_DEFAULT_LIFETIME_SECS.getValue(properties);
    int maxCacheEntries = Parameters.MAX_CACHE_ENTRIES.getValue(properties);
    long maxObjectSize = Parameters.MAX_OBJECT_SIZE.getValue(properties);

    // Asynchronous revalidation
    int minAsynchronousWorkers = Parameters.MIN_ASYNCHRONOUS_WORKERS.getValue(properties);
    int maxAsynchronousWorkers = Parameters.MAX_ASYNCHRONOUS_WORKERS.getValue(properties);
    int asynchronousWorkerIdleLifetimeSecs = Parameters.ASYNCHRONOUS_WORKER_IDLE_LIFETIME_SECS
            .getValue(properties);/* ww w  .ja  v a 2s  .c  o  m*/
    int maxUpdateRetries = Parameters.MAX_UPDATE_RETRIES.getValue(properties);
    int revalidationQueueSize = Parameters.REVALIDATION_QUEUE_SIZE.getValue(properties);

    CacheConfig.Builder builder = CacheConfig.custom();
    builder.setHeuristicCachingEnabled(heuristicCachingEnabled);
    builder.setHeuristicCoefficient(heuristicCoefficient);
    builder.setHeuristicDefaultLifetime(heuristicDefaultLifetimeSecs);
    builder.setMaxCacheEntries(maxCacheEntries);
    long usedMaxObjectSize = Long.MAX_VALUE;
    if (maxObjectSize > 0) {
        usedMaxObjectSize = maxObjectSize;
    }
    builder.setMaxObjectSize(usedMaxObjectSize);
    builder.setAsynchronousWorkersCore(minAsynchronousWorkers);
    builder.setAsynchronousWorkersMax(maxAsynchronousWorkers);
    builder.setAsynchronousWorkerIdleLifetimeSecs(asynchronousWorkerIdleLifetimeSecs);
    builder.setMaxUpdateRetries(maxUpdateRetries).setRevalidationQueueSize(revalidationQueueSize);
    builder.setSharedCache(true);
    return builder.build();
}