// 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.io.UnsupportedEncodingException;

public class CW {
    public static void main(String[] args) throws UnsupportedEncodingException {
        int tot = 0;
        int prob_utf8 = 0;
        int prob_utf16 = 0;
        int prob_utf32 = 0;
        for(int i = 0x0000; i <= 0x10FFFF; i++) {
            String s = new String(new int[] { i }, 0, 1);
            int len_utf8 = s.getBytes("UTF-8").length;
            if(len_utf8 != 1) prob_utf8++;
            int len_utf16 = s.getBytes("UTF-16LE").length;
            if(len_utf16 != 2) prob_utf16++;
            int len_utf32 = s.getBytes("UTF-32").length;
            if(len_utf32 != 4) prob_utf32++;
            tot++;
        }
        System.out.printf("%d / %d and %d / %d\n", prob_utf8, tot, tot - prob_utf8, tot);
        System.out.printf("%d / %d and %d / %d\n", prob_utf16, tot, tot - prob_utf16, tot);
        System.out.printf("%d / %d and %d / %d\n", prob_utf32, tot, tot - prob_utf32, tot);
    }
}
