You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OctalChars.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import org.aspectj.testing.Tester;
  2. public class OctalChars {
  3. public static void main(String[] args) {
  4. new OctalChars().realMain(args);
  5. }
  6. public void realMain(String[] args) {
  7. char[][] chars = {
  8. {'\0','\00','\000',},{'\1','\01','\001',},{'\2','\02','\002',},{'\3','\03','\003',},
  9. {'\4','\04','\004',},{'\5','\05','\005',},{'\6','\06','\006',},{'\7','\07','\007',},
  10. {'\10','\010',},{'\11','\011',},{'\12','\012',},{'\13','\013',},
  11. {'\14','\014',},{'\15','\015',},{'\16','\016',},{'\17','\017',},
  12. {'\20','\020',},{'\21','\021',},{'\22','\022',},{'\23','\023',},
  13. {'\24','\024',},{'\25','\025',},{'\26','\026',},{'\27','\027',},
  14. {'\30','\030',},{'\31','\031',},{'\32','\032',},{'\33','\033',},
  15. {'\34','\034',},{'\35','\035',},{'\36','\036',},{'\37','\037',},
  16. {'\40','\040',},{'\41','\041',},{'\42','\042',},{'\43','\043',},
  17. {'\44','\044',},{'\45','\045',},{'\46','\046',},{'\47','\047',},
  18. {'\50','\050',},{'\51','\051',},{'\52','\052',},{'\53','\053',},
  19. {'\54','\054',},{'\55','\055',},{'\56','\056',},{'\57','\057',},
  20. {'\60','\060',},{'\61','\061',},{'\62','\062',},{'\63','\063',},
  21. {'\64','\064',},{'\65','\065',},{'\66','\066',},{'\67','\067',},
  22. {'\70','\070',},{'\71','\071',},{'\72','\072',},{'\73','\073',},
  23. {'\74','\074',},{'\75','\075',},{'\76','\076',},{'\77','\077',},
  24. };
  25. for (int i = 0; i < chars.length; i++) {
  26. char[] cs = chars[i];
  27. for (int j = 0; j < cs.length; j++) {
  28. Tester.check((int)cs[j]==i, i + "!='\\"+Integer.toOctalString(i)+"'");
  29. }
  30. }
  31. // for (int i = 0; i < 8; i++) {
  32. // String s = Integer.toOctalString(i)+"";
  33. // System.out.print("{");
  34. // for (int j = 0; j < 3; j++, s = "0" + s) {
  35. // System.out.print("'\\"+s+"',");
  36. // }
  37. // System.out.println("},");
  38. // }
  39. // for (int i = 010; i < 0100; i++) {
  40. // String s = Integer.toOctalString(i)+"";
  41. // System.out.print("{");
  42. // for (int j = 0; j < 2; j++, s = "0" + s) {
  43. // System.out.print("'\\"+s+"',");
  44. // }
  45. // System.out.println("},");
  46. // }
  47. }
  48. }