Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static byte[] getIntArray(int val) { ByteBuffer typeBuffer = ByteBuffer.allocate(4).order(ByteOrder.BIG_ENDIAN); typeBuffer.putInt(val); return typeBuffer.array(); } }