如何知道“\ 141 \ 142 \ 163 \ 164 \ 162 \ 141 \ 143 \ 164”代表文字标记字符以及什么是“@”?
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null, null,
"\141\142\163\164\162\141\143\164", "\142\157\157\154\145\141\156", "\142\162\145\141\153", "\142\171\164\145",
"\143\141\163\145", "\143\141\164\143\150", "\143\150\141\162", "\143\154\141\163\163",
"\143\157\156\163\164", "\143\157\156\164\151\156\165\145", "\144\145\146\141\165\154\164",
"\144\157", "\144\157\165\142\154\145", "\145\154\163\145",
"\145\170\164\145\156\144\163", "\146\141\154\163\145", "\146\151\156\141\154",
"\146\151\156\141\154\154\171", "\146\154\157\141\164", "\146\157\162", "\147\157\164\157", "\151\146",
"\151\155\160\154\145\155\145\156\164\163", "\151\155\160\157\162\164", "\151\156\163\164\141\156\143\145\157\146",
"\151\156\164", "\151\156\164\145\162\146\141\143\145", "\154\157\156\147",
"\156\141\164\151\166\145", "\156\145\167", "\156\165\154\154", "\160\141\143\153\141\147\145",
"\160\162\151\166\141\164\145", "\160\162\157\164\145\143\164\145\144", "\160\165\142\154\151\143",
"\162\145\164\165\162\156", "\163\150\157\162\164", "\163\164\141\164\151\143", "\163\165\160\145\162",
"\163\167\151\164\143\150", "\163\171\156\143\150\162\157\156\151\172\145\144", "\164\150\151\163",
"\164\150\162\157\167", "\164\150\162\157\167\163", "\164\162\141\156\163\151\145\156\164",
"\164\162\165\145", "\164\162\171", "\166\157\151\144", "\166\157\154\141\164\151\154\145",
"\167\150\151\154\145", "\163\164\162\151\143\164\146\160", "\141\163\163\145\162\164", null, null,
null, null, null, null, null, null, null, null, null, "\50", "\51", "\173", "\175",
"\133", "\135", "\73", "\54", "\56", "\75", "\76", "\74", "\41", "\176", "\77", "\72",
"\75\75", "\74\75", "\76\75", "\41\75", "\174\174", "\46\46", "\53\53", "\55\55", "\53",
"\55", "\52", "\57", "\46", "\174", "\136", "\45", "\74\74", "\76\76", "\76\76\76",
"\53\75", "\55\75", "\52\75", "\57\75", "\46\75", "\174\75", "\136\75", "\45\75",
"\74\74\75", "\76\76\75", "\76\76\76\75", };
答案 0 :(得分:3)
非常简单:
System.out.println("\141\142\163\164\162\141\143\164"); // first String
结果:abstract
单行:
for(String s:jjstrLiteralImages) if (s!=null) System.out.println(s);
String中的转义值是ASCII值的八进制表示:
/141 = 97 = 'a'
进一步阅读:
答案 1 :(得分:3)
试试这个:
System.out.println(Arrays.toString(new String[] { /* your array here */ }));
输出:
[,null,null,null,null,null,null, null,null,null,null,null,null, null,abstract,boolean,break,byte, case,catch,char,class,const, 继续,默认,执行,双重,否则, extends,false,final,finally,float, for,goto,if,implements,import, instanceof,int,interface,long, native,new,null,package,private, 受保护的,公共的,回归的,短的, 静态,超级,开关,同步, 这,抛出,抛出,瞬态,真实, try,void,volatile,while,strictfp, assert,null,null,null,null,null, null,null,null,null,null,null,(, ),{,},[,],; ,,,。,=,>,<,!,〜, ?,:,==,< =,> =,!=,||,&&,++, - , +, - ,*,/,&,|,^,%,<<,>>,>>>,+ =, - =,* =,/ =,& =, | =,^ =,%=,<< =,>> =,>>> =]
(听起来像是java语言的保留关键字)
参考:
Arrays.toString(Object[])是一个生成数组元素的toString()表示的辅助方法。还有Arrays.deepToString(Object[])在嵌套数组上递归执行相同的任务。
旁注:
我尝试对输出进行排序并删除空值,但它不会比这更短:
final Set<String> set=
new HashSet<String>(Arrays.asList(arr));
set.remove(null);
System.out.println(new TreeSet<String>(set));
或者:
final List<String> list =
new ArrayList<String>(Arrays.asList(arr));
while(list.remove(null)){}
Collections.sort(list);
System.out.println(list);
有人有更短的版本吗?
答案 2 :(得分:0)
那些看起来像只是相应ASCII值的转义字符。尝试查找ASCII代码列表并进行比较。