Here you can find the source of intToLittleEndian(int value)
static byte[] intToLittleEndian(int value)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { /** Converts an int to the corresponding 4-byte little endian array. */ static byte[] intToLittleEndian(int value) { return integerToLittleEndian(new byte[4], 0, value, 4); }/*from www . j av a2 s. c o m*/ /** Writes an int to the buffer as a 4-byte little endian array starting at offset. */ static byte[] intToLittleEndian(byte[] buf, int offset, int value) { return integerToLittleEndian(buf, offset, value, 4); } /** 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)); } return buf; } }