Here you can find the source of int2byteArray(int k, byte b[], int off)
public static void int2byteArray(int k, byte b[], int off)
//package com.java2s; //License from project: Open Source License public class Main { public final static int INT_BYTES = 4; public static void int2byteArray(int k, byte b[], int off) { int j;/* ww w. j av a 2 s . c om*/ j = b.length; if (b == null || j <= off) { return; } j -= off; if (j > INT_BYTES) { j = INT_BYTES; } switch (j) { case 4: b[off + 3] = (byte) ((k >> 24) & 0x0ff); case 3: b[off + 2] = (byte) ((k >> 16) & 0x0ff); case 2: b[off + 1] = (byte) ((k >> 8) & 0x0ff); case 1: b[off] = (byte) (k & 0x0ff); } } }