Here you can find the source of integerToLittleEndian(byte[] buf, int offset, long value, int numBytes)
private static byte[] integerToLittleEndian(byte[] buf, int offset, long value, int numBytes)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { /** Converts a integral value to the corresponding little endian array. */ private static byte[] integerToLittleEndian(byte[] buf, int offset, long value, int numBytes) { for (int i = 0; i < numBytes; i++) { buf[i + offset] = (byte) ((value & (0xffL << (i * 8))) >> (i * 8)); }//w w w . j a va 2 s . co m return buf; } }