Java examples for Internationalization:Charset
get Long Value From Byte Array Little Endian
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte[] byteArray = new byte[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 }; int offset = 2; System.out.println(getLongValueFromByteArrayLittleEndian(byteArray, offset));/* w w w . jav a 2 s . c o m*/ } public static long getLongValueFromByteArrayLittleEndian( byte[] byteArray, int offset) { long val = 0; val = ((((long) byteArray[offset]) << 8 >> 8) & 0xFFL) + ((((long) byteArray[offset + 1]) << 8) & 0xFF00L) + ((((long) byteArray[offset + 2]) << 16) & 0xFF0000L) + ((((long) byteArray[offset + 3]) << 24) & 0xFF000000L) + ((((long) byteArray[offset + 4]) << 32) & 0xFF00000000L) + ((((long) byteArray[offset + 5]) << 40) & 0xFF0000000000L) + ((((long) byteArray[offset + 6]) << 48) & 0xFF000000000000L) + ((((long) byteArray[offset + 7]) << 56) & 0xFF00000000000000L); return val; } }