// 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 BigEndianFun {
    public static void main(String[] args) {
        String s = "ABCabc123ÆØÅæøå";
        byte[] b = new byte[2*s.length()];
        ByteBuffer bb = ByteBuffer.wrap(b);
        bb.order(ByteOrder.BIG_ENDIAN);
        for(int i = 0; i < s.length(); i++) {
            bb.putChar(s.charAt(i));
        }
    }
}
