Java Utililty Methods Long Number Create

List of utility methods to do Long Number Create

Description

The list of methods to do Long Number Create are organized into topic(s).

Method

longtoLong(String src)
to Long
long dest = 0;
if (src == null || src.trim().equals("")) {
    return 0;
try {
    dest = Long.parseLong(src.trim());
} catch (Exception e) {
return dest;
longtoLong(String str)
Converts a string to a long .
return Long.parseLong(str);
longtoLong(String str)
to Long
return toLong(str, 0L);
LongtoLong(String str)
to Long
if (isEmpty(str))
    return null;
try {
    return Long.parseLong(str);
} catch (Exception e) {
    e.printStackTrace();
    return null;
longtoLong(String str)

Convert a String to a long, returning zero if the conversion fails.

If the string is null, zero is returned.

 NumberUtility.toLong(null) = 0L NumberUtility.toLong("")   = 0L NumberUtility.toLong("1")  = 1L 
return toLong(str, 0L);
LongtoLong(String str)
to Long
if (str == null || str.length() == 0) {
    return null;
} else {
    return Long.parseLong(str);
longtoLong(String str)

Convert a String to a long, returning zero if the conversion fails.

return toLong(str, 0L);
longtoLong(String str, long defaultValue)
to Long
if (str == null) {
    return defaultValue;
try {
    return Long.parseLong(str);
} catch (NumberFormatException nfe) {
    return defaultValue;
longtoLong(String str, long val)
to Long
return str != null ? Long.parseLong(str) : val;
longtoLong(String string)
to Long
if (!isBinary(string))
    return 0;
if (string.length() > 63)
    return Long.MAX_VALUE;
return Long.parseLong(string, 2);