Here you can find the source of int2byte(byte[] output, int[] input, int len)
final static void int2byte(byte[] output, int[] input, int len)
//package com.java2s; public class Main { /**/* ww w.j av a2s .co m*/ * Encodes input (int) into output (bytes). * Assumes len is a multiple of 4. */ final static void int2byte(byte[] output, int[] input, int len) { int i = 0; if ((len % 4) != 0) { println("Error: int2byte(..., len), len not multiple of 4"); println("Error: result will probably be wrong"); } for (int j = 0; j < len; j += 4) { output[j + 0] = (byte) (input[i] & 0xff); output[j + 1] = (byte) ((input[i] >>> 8) & 0xff); output[j + 2] = (byte) ((input[i] >>> 16) & 0xff); output[j + 3] = (byte) ((input[i] >>> 24) & 0xff); i++; } } final static void println(String s) { System.out.println(s); } }