Here you can find the source of intToBytes(byte[] arr, int offset, int num)
public static int intToBytes(byte[] arr, int offset, int num)
//package com.java2s; //License from project: Open Source License public class Main { public static final int INT_SIZE = 4; public static int intToBytes(byte[] arr, int offset, int num) { arr[offset + 0] = (byte) (num >> 24); arr[offset + 1] = (byte) (num >> 16); arr[offset + 2] = (byte) (num >> 8); arr[offset + 3] = (byte) (num >> 0); return INT_SIZE; }/*from w w w . j a v a 2s.c om*/ }