package com.mischen.it.test;
public class TestInterview {
static String str = new String("asdsdasfbft");
public static void main(String[] args) {
long startTime=System.currentTimeMillis();
System.out.println(findViewOneString(TestInterview.str));
long endTime=System.currentTimeMillis();
System.out.println("程序运行时间: "+(endTime-startTime)+"ms");
}
public static String findViewOneString(String str ){
char[] arrChar = str.toCharArray();
int arrChar_len = arrChar.length;
String strOne = "";
StringBuffer strBuf = new StringBuffer("");
for (int i = 0; i < arrChar_len; i++) {
strOne = String.valueOf(arrChar[i]);
strBuf.append(strOne);
System.out.print(strBuf.indexOf(strOne));
System.out.print("---");
System.out.println(strBuf.length()-1);
System.out.println(strBuf);
if(!(strBuf.indexOf(strOne)!= (strBuf.length()-1))){
if((str.substring(i+1, arrChar_len).indexOf(strOne) == -1)){
System.out.println(i);
return strOne;
}
}
}
return "没有一个不重复的字符";
}
}