去阿里面试的一道小题
public static boolean indexOf(String source,String target){int sourceLength=source.length();int targetLength=target.length();if(sourceLength<targetLength){return false;}int max=sourceLength-targetLength+1;for(int i=0;i<=max;i++){if(source.charAt(i)==target.charAt(0)){int j=i+1;int end=j+targetLength-1;for(int targetOffset=1;j<end&&source.charAt(j)==target.charAt(targetOffset);j++,targetOffset++);if(j==end){return true;}}}return false;}
?