Here you can find the source of getUIntByByteArray(byte[] data)
Parameter | Description |
---|---|
data | a parameter |
public static long getUIntByByteArray(byte[] data)
//package com.java2s; public class Main { public static long getUIntByByteArray(byte[] data, boolean isLH) { long result = 0; for (int i = 0; i < data.length; i++) { byte b = data[i]; int t = getUIntByByte(b); result += t << ((isLH ? i : data.length - i - 1) * 8); }/* ww w . j a v a 2 s. co m*/ return result; } /** * new byte[] { 8, 4, 2, 1 } => 00000001 00000010 00000100 00001000 * * @param data * @return */ public static long getUIntByByteArray(byte[] data) { return getUIntByByteArray(data, true); } /** * new byte[] { 8, 4, 2, 1 } => 00000001 00000010 00000100 00001000 * * @param data * @return */ public static int getUIntByByte(byte data) { return data & 0xFF; } }