Example usage for java.lang Long parseLong

List of usage examples for java.lang Long parseLong

Introduction

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

Prototype

public static long parseLong(String s) throws NumberFormatException 

Source Link

Document

Parses the string argument as a signed decimal long .

Usage

From source file:Main.java

public static Date timeToData(String time) {
    return new Date(Long.parseLong(time));
}

From source file:Main.java

public static long parseLong(String str) {
    long num = 0;
    try {/*  www  .j av  a 2  s . c  om*/
        num = Long.parseLong(str);
    } catch (Exception e) {
    }
    return num;
}

From source file:Main.java

static long convertMemInfoToBytes(String memInfo, String notation, int notationMultiplier) {
    return Long.parseLong(memInfo.split(notation)[0].trim()) * ((long) notationMultiplier);
}

From source file:Main.java

public static long getTimestamp(String timestamp) {
    return Long.parseLong(timestamp.split(".")[0]);
}

From source file:Main.java

public static long doLong(Object obj) {
    return obj != null ? Long.parseLong(obj.toString()) : 0;
}

From source file:Main.java

public static long convertTolong(String longStr, long defValue) {
    try {//from  ww  w.  j a v a 2 s. c  om
        return Long.parseLong(longStr);
    } catch (NumberFormatException e) {
    }
    return defValue;
}

From source file:Main.java

public static String long2str(String amount) {

    return BigDecimal.valueOf(Long.parseLong(amount)).divide(BigDecimal.valueOf(100L)).toString();
}

From source file:Main.java

public static long toLong(String obj) {
    try {//from w  w  w.j ava  2  s  .c  o  m
        return Long.parseLong(obj);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return 0;
}

From source file:Main.java

public static long toLong(String str) {
    try {/*  ww w  .jav  a  2 s  . c  o m*/
        return Long.parseLong(str);
    } catch (Exception e) {
    }
    return 0;
}

From source file:Main.java

public static long formatStringToLong(String data) {
    try {/*from   w ww  .  j a va 2  s.c  o  m*/
        return Long.parseLong(data);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return -1;
}