/* * copyString * 拷贝一段字符串到新的字符串中,这个方法会new一个新的指针 */ public static String copyString(String src, int start, int len) { if(src == null) { return null; } StringBuffer sb = new StringBuffer(); for(int i = start; i < len; i++) { // 对src进行处理 } return sb.toString(); }
findbugs插件检出高报警BUG。
Type Abbreviation Type Category IL IL_INFINITE_LOOP:An apparent infinite loop This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).