Java Utililty Methods Long Number From

List of utility methods to do Long Number From

Description

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

Method

longlongFromLex(byte[] bytes)
Converts lexicographical sortable long to a regular java long
long v = bytesLong(bytes, 0);
v ^= c64;
return v;
longlongFromObject(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) {
...
LongtoLongAsObject(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;
longtoLongBE(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));
longtoLongBE(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));
StringtoLongDate()
to Long Date
return String.valueOf(toLongTime());
longtoLongDefaultIfNull(Long configured, long theDefault)
to Long Default If Null
return configured != null ? configured.longValue() : theDefault;
longtoLongExactWithoutOverflow(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;
LongtoLongId(Integer i)
to Long Id
if (i == null)
    return null;
return Long.valueOf(i.longValue());
longtoLongInt(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;
...