List of utility methods to do Long Number Create
long | toLong(Object value) to Long if (value instanceof Number) return ((Number) value).longValue(); return Long.parseLong(value.toString()); |
Long | toLong(Object value) to Long if (value == null) { return 0L; } else { Long longNum = new Long(value.toString()); return longNum; |
Long | toLong(Object value) to Long try { if (value == null || EMPTY.equals(value)) { return null; return Long.valueOf(value.toString()); } catch (Exception e) { e.printStackTrace(); return null; ... |
long | toLong(Object value) to Long if (value instanceof Number) return ((Number) value).longValue(); else if (value == null) return 0; else return Long.parseLong(value.toString()); |
Long | toLong(Object value) to Long return toLong(value, 0L);
|
long | toLong(Object value, long defaultValue) Converts a generic object value to a long if possible:
if (value == null) { return defaultValue; } else if (value instanceof Number) { return ((Number) value).longValue(); } else { return Long.parseLong(value.toString()); |
Long | toLong(Object x) to Long if (x == null) return null; if (x instanceof Long) return (Long) x; if (x instanceof Integer) return Long.valueOf(((Integer) x).intValue()); if (x instanceof String) return Long.valueOf((String) x); ... |
long[] | toLong(short[] arr) Converts an array of short values to an array of long values. int n = arr.length; long[] converted = new long[n]; for (int i = 0; i < n; i++) { converted[i] = arr[i]; return converted; |
long | toLong(String input, int radix, long defaultValue) to Long try { return Long.parseLong(input, radix); } catch (Exception e) { return defaultValue; |
long | toLong(String numeric) to Long return (isNumeric(numeric)) ? Long.parseLong(numeric) : 0;
|