Here you can find the source of IntToBytes(int i)
public static byte[] IntToBytes(int i)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] IntToBytes(int i) { byte abyte0[] = new byte[2]; abyte0[1] = (byte) (0xff & i); abyte0[0] = (byte) ((0xff00 & i) >> 8); return abyte0; }/* w ww . j a v a2s. c o m*/ public static void IntToBytes(int i, byte abyte0[]) { abyte0[1] = (byte) (0xff & i); abyte0[0] = (byte) ((0xff00 & i) >> 8); } }