去掉字符串中连续出现K个0的子串
public static String remove(String str, int k){
if(str == null || k < 1){
return str;
}
char[] cc = str.toCharArray();
int count = 0;
int start = -1;
for(int i = 0; i != cc.length; i ++){
if(cc[i] == '0'){
count ++;
start = start == -1 ? i : start;
}else {
if(count == k){
while (count -- != 0)
cc[start ++] = '\0';
}
count = 0;
start = -1;
}
}
if(count == k){
while(count -- != 0){
cc[start ++] = '\0';
}
}
return String.valueOf(cc);
}