Java Long Number From toLongs(byte[] readBuffer, int o, int l)

Here you can find the source of toLongs(byte[] readBuffer, int o, int l)

Description

to Longs

License

Open Source License

Declaration

public static long[] toLongs(byte[] readBuffer, int o, int l) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static long[] toLongs(byte[] readBuffer, int o, int l) {
        long[] v = new long[l / 8];
        for (int i = 0; i < v.length; i++)
            v[i] = toLong(readBuffer, o + i * 8);
        return v;
    }/* w  w w  .ja  va 2 s.  co  m*/

    public static long toLong(byte[] readBuffer, int o) {
        return (((long) readBuffer[0] << 56) + ((long) (readBuffer[1] & 255) << 48)
                + ((long) (readBuffer[2] & 255) << 40) + ((long) (readBuffer[3] & 255) << 32)
                + ((long) (readBuffer[4] & 255) << 24) + ((readBuffer[5] & 255) << 16)
                + ((readBuffer[6] & 255) << 8) + ((readBuffer[7] & 255) << 0));
    }

    public static long toLong(byte[] readBuffer) {
        return toLong(readBuffer, 0);
    }
}

Related

  1. toLongList(String valus)
  2. toLongMatrix(Number[][] matrix)
  3. toLongMin(double[] in, long[] out)
  4. toLongObject(Object obj)
  5. toLongs(byte[] bytes)
  6. toLongs(byte[] value, int offset, int num)
  7. toLongs(int[] array)
  8. toLongs(Long[] values)
  9. toLongTime()