// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class BigEndianAgain {
    public static byte[] toBigEndian(int i) {
        byte[] bbig = new byte[4];
        ByteBuffer bbbig = ByteBuffer.wrap(bbig);
        bbbig.order(ByteOrder.BIG_ENDIAN);
        bbbig.putInt(i);
        return bbig;
    }
    public static void main(String[] args) {
        byte[] ba = toBigEndian(117);
        for(byte b : ba) {
            System.out.print(" " + (b & 0xFF));
        }
        System.out.println();
    }
}
