Example usage for java.lang Long Long

List of usage examples for java.lang Long Long

Introduction

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

Prototype

@Deprecated(since = "9")
public Long(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Long object that represents the long value indicated by the String parameter.

Usage

From source file:Main.java

public static Long parseLong(String s) {
    try {//from   w w  w .jav  a  2s.  co  m
        return new Long(s);
    } catch (NumberFormatException e) {
        return null;
    }
}

From source file:Main.java

public static final Long toLong(String value) {
    try {/*from  ww w. j a v  a 2s.  c o  m*/
        return new Long(value);
    } catch (Throwable t) {
        return null;
    }
}

From source file:Main.java

public static long toLong(String s) {
    return new Long(s).longValue();
}

From source file:Main.java

public static <RET> RET fromBase36(String basecode) {
    Long result = Long.valueOf(basecode, 36);
    long maxInt = new Long(Integer.MAX_VALUE);

    if (result > maxInt) {
        return ((RET) result);
    } else {/*from  w w w .  jav  a 2  s .co  m*/
        return ((RET) (Integer) result.intValue());
    }

}

From source file:Main.java

public static Long[] toLongArray(long[] array) {
    Long[] arr = new Long[array.length];
    for (int i = 0; i < array.length; i++) {
        arr[i] = new Long(array[i]);
    }//w w  w .  j a  va2  s .c  om
    return arr;
}

From source file:Main.java

public static void putDouble(byte[] bb, double x, int index) {
    long l = Double.doubleToLongBits(x);
    for (int i = index; i < index + 8; i++) {
        bb[i] = new Long(l).byteValue();
        l = l >> 8;/*from  w  ww .j a  v a  2s  . c  o  m*/
    }
}

From source file:Main.java

public static byte[] doubleToByte(double d) {
    byte[] b = new byte[8];
    long l = Double.doubleToRawLongBits(d);
    for (int i = 0; i < 8; i++) {
        b[i] = new Long(l).byteValue();
        l = l >> 8;//from  www . j  av a2s  .co m
    }
    return b;
}

From source file:Main.java

public static void putDouble(byte[] bb, double x, int index) {
    // byte[] b = new byte[8];
    long l = Double.doubleToLongBits(x);
    for (int i = 0; i < 4; i++) {
        bb[index + i] = new Long(l).byteValue();
        l = l >> 8;/*w w  w  . ja  va2  s.  c om*/
    }
}

From source file:Main.java

public static Long getIndexFromName(String name) {
    int last = name.lastIndexOf("-");
    String aux = name.substring(last + 1);
    long r = 0;//from   w w  w  .  j  a  va2 s  .c  om
    try {
        r = Long.parseLong(aux);
        return new Long(r);
    } catch (Exception ex) {
        return null;
    }
}

From source file:Main.java

static long getLastModified(final File f) {
    return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            return new Long(f.lastModified());
        }/* w w  w. j a  va 2 s.  com*/
    })).longValue();
}