List of utility methods to do Long Number From
long | longFromLex(byte[] bytes) Converts lexicographical sortable long to a regular java long long v = bytesLong(bytes, 0); v ^= c64; return v; |
long | longFromObject(Object o) Converts an object to a long value.
if (o != null) { if (o instanceof Integer) { return ((Integer) o).longValue(); if (o instanceof Long) { return ((Long) o).longValue(); if (o instanceof Double) { ... |
Long | toLongAsObject(Object obj) to Long As Object if (obj != null) { if (obj instanceof Long) { return (Long) obj; } else { try { return Long.parseLong(String.valueOf(obj)); } catch (Exception e) { return null; |
long | toLongBE(byte[] b, int i) to Long BE return (((long) b[i + 0] << 56) + ((long) (b[i + 1] & 255) << 48) + ((long) (b[i + 2] & 255) << 40) + ((long) (b[i + 3] & 255) << 32) + ((long) (b[i + 4] & 255) << 24) + ((b[i + 5] & 255) << 16) + ((b[i + 6] & 255) << 8) + ((b[i + 7] & 255) << 0)); |
long | toLongBE(byte[] src, int offset) 64bit to long return (((src[offset] & 0xFFl) << 56l) + ((src[++offset] & 0xFFl) << 48l) + ((src[++offset] & 0xFFl) << 40l)
+ ((src[++offset] & 0xFFl) << 32l) + ((src[++offset] & 0xFFl) << 24l)
+ ((src[++offset] & 0xFFl) << 16l) + ((src[++offset] & 0xFFl) << 8l) + (src[++offset] & 0xFFl));
|
String | toLongDate() to Long Date return String.valueOf(toLongTime());
|
long | toLongDefaultIfNull(Long configured, long theDefault) to Long Default If Null return configured != null ? configured.longValue() : theDefault;
|
long | toLongExactWithoutOverflow(float value) Like Math#toIntExact(long) but for long range. if (value < Long.MIN_VALUE || value > Long.MAX_VALUE) { throw new ArithmeticException("long overflow"); return (long) value; |
Long | toLongId(Integer i) to Long Id if (i == null) return null; return Long.valueOf(i.longValue()); |
long | toLongInt(byte[] b) to Long Int if (b.length > 8) throw new NumberFormatException("long has only 8 bytes"); long i = 0; for (byte x : b) { i <<= 8; i |= (x & 0xFF); return i; ... |