【发布时间】:2012-12-08 13:43:29
【问题描述】:
我不太确定这段代码是如何工作的:
public static boolean isUniqueChar2(String str) {
int checker = 0;
for (int i = 0; i < str.length(); ++i) {
int val = str.charAt(i) - 'a';
System.out.println(str.charAt(i) );
System.out.println(val);
if ((checker & (1 << val)) > 0)
return false;
checker |= (1 << val);
}
return true;
}
特别不明白>> 运算符和checker的作用
【问题讨论】:
-
你在代码中哪里使用了
>>操作?
标签: java string character operator-keyword