Example usage for java.lang Long MIN_VALUE

List of usage examples for java.lang Long MIN_VALUE

Introduction

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

Prototype

long MIN_VALUE

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

Click Source Link

Document

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

Usage

From source file:com.parivero.swagger.demo.controller.PaisController.java

/**
 *
 * @return/*from   w  w  w  . j a  va2 s. c om*/
 */
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody Collection<Pais> buscarTodos() {
    Pais pais = new Pais();
    pais.setId(Long.MIN_VALUE);
    pais.setNombre("Argentina");
    Collection<Pais> paises = new ArrayList<>();
    paises.add(pais);
    paises.add(pais);
    return paises;
}

From source file:cz.cvut.kbss.wpa.dto.test.AbstractObjectCloneTest.java

@Test
public void testUserClone() throws CloneNotSupportedException {
    PlayerDTO p = new PlayerDTO();
    p.setName("Test_name");
    p.setSurname("Test_surname");
    p.setHeight(200);/*  ww  w. ja  va 2  s . c om*/
    p.setUsername("Test_Username");
    p.setPassword("Test_pass");
    p.setId(Long.MIN_VALUE);

    PlayerDTO clone = (PlayerDTO) p.clone();

    assertEquals(clone.getName(), p.getName());
    assertThat(clone.getId(), sameInstance(p.getId()));
    assertThat(p.getName(), sameInstance(clone.getName()));

    clone.setName("Clone_name");
    clone.setId(Long.MAX_VALUE);

    assertThat(p.getName(), not(sameInstance(clone.getName())));
    assertThat(p.getId(), not(sameInstance(clone.getId())));

    assertThat(clone.getName(), not(p.getName()));
    assertThat(clone.getId(), not(p.getId()));
}

From source file:gxu.software_engineering.market.android.util.ServiceHelper.java

public static void pre(Intent intent) {
    int target = intent.getIntExtra(C.TARGET_ENTITY, -1);
    long uid = Long.MIN_VALUE;
    long cid = Long.MIN_VALUE;
    switch (target) {
    case CATEGORIES:
        intent.putExtra(C.HTTP_URI, C.DOMAIN + "/categories");
        break;/* w  w  w .  j a va  2 s.com*/
    case LASTEST_USERS:
        intent.putExtra(C.HTTP_URI, C.DOMAIN + "/users?type=1&count=50");
        break;
    case LASTEST_ITEMS:
        intent.putExtra(C.HTTP_URI, C.DOMAIN + "/items?type=1&count=50");
        break;
    case HOTTEST_ITEMS:
        intent.putExtra(C.HTTP_URI, C.DOMAIN + "/items?type=6&count=20");
        break;
    case USER_ITEMS:
        uid = intent.getLongExtra(C.UID, -1);
        intent.putExtra(C.HTTP_URI, C.DOMAIN
                + String.format("/items?type=4&count=%d&uid=%d&deal=0&last_id=0", C.DEFAULT_LIST_SIZE, uid));
        break;
    case CATEGORY_ITEMS:
        cid = intent.getLongExtra(C.CID, -1);
        intent.putExtra(C.HTTP_URI,
                C.DOMAIN + String.format("/items?type=5&count=%d&cid=%d&last_id=0", C.DEFAULT_LIST_SIZE, cid));
        break;
    case USER_CLOSED_ITEMS:
        uid = intent.getLongExtra(C.UID, -1);
        intent.putExtra(C.HTTP_URI,
                C.DOMAIN + String.format("/items?type=7&count=%d&uid=%d&last_id=0", C.DEFAULT_LIST_SIZE, uid));
        break;
    case USER_DEAL_ITEMS:
        uid = intent.getLongExtra(C.UID, uid);
        intent.putExtra(C.HTTP_URI,
                C.DOMAIN + String.format("/items?type=4&count=%d&uid=%d&deal=1", C.DEFAULT_LIST_SIZE, uid));
        break;
    default:
        throw new IllegalArgumentException("sorry, 404 for the target[" + target + "]");
    }
}

From source file:net.sf.sprockets.sql.Statements.java

/**
 * Execute the query, get the long value in the first row and column of the result set, and
 * close the statement.//from  ww w  .ja  v  a  2  s.com
 * 
 * @param stmt
 *            must already have parameters set
 * @return {@link Long#MIN_VALUE} if the result set is empty
 */
public static long firstLong(PreparedStatement stmt) throws SQLException {
    ResultSet rs = stmt.executeQuery();
    long l = rs.next() ? rs.getLong(1) : Long.MIN_VALUE;
    stmt.close();
    return l;
}

From source file:com.redhat.smonkey.RndLong.java

@Override
public JsonNode generate(JsonNodeFactory nodeFactory, JsonNode data, Monkey mon) {
    long min = Utils.asLong(data.get("min"), Long.MIN_VALUE);
    long max = Utils.asLong(data.get("max"), Long.MAX_VALUE);
    long x = Utils.rndl(min, max);
    return nodeFactory.numberNode(x);
}

From source file:com.datumbox.common.utilities.ProcessStatistics.java

public long peakMemoryBytes() {
    long maxBytes = Long.MIN_VALUE;

    List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
    for (MemoryPoolMXBean pool : pools) {
        MemoryUsage peak = pool.getPeakUsage();

        long peakUsed = peak.getUsed();
        if (maxBytes < peakUsed) {
            maxBytes = peakUsed;/*w  w w  .  java  2  s.  c o m*/
        }
    }

    return maxBytes;
}

From source file:Main.java

/**
 * Add two long integers, checking for overflow.
 * /*www. j  a  v a 2s . c  o m*/
 * @param a an addend
 * @param b an addend
 * @param msg the message to use for any thrown exception.
 * @return the sum <code>a+b</code>
 * @throws ArithmeticException if the result can not be represented as an
 *         long
 * @since 1.2
 */
private static long addAndCheck(long a, long b, String msg) {
    long ret;
    if (a > b) {
        // use symmetry to reduce boundry cases
        ret = addAndCheck(b, a, msg);
    } else {
        // assert a <= b

        if (a < 0) {
            if (b < 0) {
                // check for negative overflow
                if (Long.MIN_VALUE - b <= a) {
                    ret = a + b;
                } else {
                    throw new ArithmeticException(msg);
                }
            } else {
                // oppisite sign addition is always safe
                ret = a + b;
            }
        } else {
            // assert a >= 0
            // assert b >= 0

            // check for positive overflow
            if (a <= Long.MAX_VALUE - b) {
                ret = a + b;
            } else {
                throw new ArithmeticException(msg);
            }
        }
    }
    return ret;
}

From source file:id.ac.idu.backend.model.ApplicationNews.java

public boolean isNew() {
    return (getId() == Long.MIN_VALUE);
}

From source file:de.forsthaus.backend.model.ApplicationNews.java

public boolean isNew() {
    return (getId() == Long.MIN_VALUE + 1);
}

From source file:com.cloudera.oryx.rdf.common.tree.TreePath.java

boolean isLeftAt(int index) {
    Preconditions.checkElementIndex(index, pathLength);
    return ((Long.MIN_VALUE >>> index) & leftRight) == 0;
}