public class test {
public static void main(String[] args) {
Boolean bool = isMultiChar("sdhajk1h3ddjkl123") ;
System.out.println(bool);
}
/**
* 该方法通过定一个 空数组,256的长度足够,遍历所有的字符串,然后判断相同字符串出现的次数即可,实现较为简单和巧妙
* @param source
* @return
*/
public static boolean isMultiChar(String source){
int[] charInt = new int[256];
for(int i=0;i<source.length();i++){
if(charInt[source.charAt(i)] ++ >= 2 )
return true;
}
return false;
}
}