Here you can find the source of intToBytesLittleEndian(final int i, final byte[] dest, final int offset)
int
into byte array
Parameter | Description |
---|---|
i | data |
dest | output data |
offset | where to write to |
public static void intToBytesLittleEndian(final int i, final byte[] dest, final int offset)
//package com.java2s; public class Main { /**/*ww w . ja v a 2 s.c o m*/ * Single <code>int</code> into byte array * @param i data * @param dest output data * @param offset where to write to */ public static void intToBytesLittleEndian(final int i, final byte[] dest, final int offset) { dest[offset] = (byte) (i & 0xFF); dest[offset + 1] = (byte) ((i >> 8) & 0xFF); dest[offset + 2] = (byte) ((i >> 16) & 0xFF); dest[offset + 3] = (byte) ((i >> 24) & 0xFF); } }