Here you can find the source of toBytesInt32BE(int w)
public static byte[] toBytesInt32BE(int w)
//package com.java2s; public class Main { public static byte[] toBytesInt32BE(int w) { byte[] ret = new byte[4]; writeInt32BE(ret, 0, w);//from w ww .ja v a 2 s . c o m return ret; } public static void writeInt32BE(byte[] target, int offset, int w) { target[offset] = (byte) ((w >> 24) & 0xFF); // most significant byte first target[offset + 1] = (byte) ((w >> 16) & 0xFF); target[offset + 2] = (byte) ((w >> 8) & 0xFF); target[offset + 3] = (byte) (w & 0xFF); // least significant byte next } }