Example usage for java.lang Short longValue

List of usage examples for java.lang Short longValue

Introduction

In this page you can find the example usage for java.lang Short longValue.

Prototype

public long longValue() 

Source Link

Document

Returns the value of this Short as a long after a widening primitive conversion.

Usage

From source file:Main.java

public static void main(String[] args) {
    Short shortObject = new Short("10");
    long l = shortObject.longValue();
    System.out.println("long:" + l);
}

From source file:Main.java

public static void main(String[] args) {
    Short sObj = new Short("10");

    byte b = sObj.byteValue();
    System.out.println(b);/*from w  ww  .ja va  2s.c  o m*/

    short s = sObj.shortValue();
    System.out.println(s);

    int i = sObj.intValue();
    System.out.println(i);

    float f = sObj.floatValue();
    System.out.println(f);

    double d = sObj.doubleValue();
    System.out.println(d);

    long l = sObj.longValue();
    System.out.println(l);
}

From source file:com.evolveum.midpoint.repo.sql.util.RUtil.java

public static Long toLong(Short s) {
    if (s == null) {
        return null;
    }//from w  w w. j a v  a  2 s. c  o m

    return s.longValue();
}

From source file:com.magnet.android.mms.controller.RequestPrimitiveTest.java

@SmallTest
public void testSingleListShortPostParam() throws JSONException {
    ControllerHandler handler = new ControllerHandler();
    String methodName = "postShorts";
    JMethod method = new JMethod();
    JMeta metaInfo = new JMeta(methodName, API_METHOD_POST + methodName, POST);
    method.setMetaInfo(metaInfo);// ww w .  ja v a2s  .c o m

    method.addParam("param0", PLAIN, List.class, Short.class, "", false);

    List<Short> values = new ArrayList<Short>();
    values.add((short) 3456);
    values.add((short) 1);
    values.add((short) 0);

    String uriString = handler.buildUri(method, new Object[] { values });
    String bodyString = handler.buildRequestBodyString(method, new Object[] { values });

    String expected = API_METHOD_POST + methodName;
    logger.log(Level.INFO, "uriString=" + uriString);
    logger.log(Level.INFO, "bodyString=" + bodyString);
    assertEquals(expected, uriString);

    JSONArray jarray = new JSONArray(bodyString);
    int idx = 0;
    for (Short value : values) {
        assertEquals(jarray.getLong(idx), value.longValue());
        idx++;
    }
}

From source file:org.op4j.functions.FnShort.java

/**
 * <p>//from  ww  w.  j a  v a2  s.  co  m
 * It performs a module operation and returns the value
 * of (input mod module) which is always positive 
 * (whereas remainder is not)
 * </p>
 * 
 * @param module the module
 * @return the result of (input mod module)
 */
public final static Function<Short, Short> module(Short module) {
    return new Module(BigInteger.valueOf(module.longValue()));
}

From source file:org.op4j.functions.FnInteger.java

/**
 * <p>//from w  w w.ja v  a 2s . c  om
 * It performs a module operation and returns the value
 * of (input mod module) which is always positive 
 * (whereas remainder is not)
 * </p>
 * 
 * @param module the module
 * @return the result of (input mod module)
 */
public final static Function<Integer, Integer> module(Short module) {
    return new Module(BigInteger.valueOf(module.longValue()));
}

From source file:org.op4j.functions.FnLong.java

/**
 * <p>/*from ww  w  .  j a v a  2s .  c om*/
 * It performs a module operation and returns the value
 * of (input mod module) which is always positive 
 * (whereas remainder is not)
 * </p>
 * 
 * @param module the module
 * @return the result of (input mod module)
 */
public final static Function<Long, Long> module(Short module) {
    return new Module(BigInteger.valueOf(module.longValue()));
}