publicstaticvoidremove3(char[] array){ if (array == null || array.length <= 0) { return; } int len = array.length; int index = 0; for (int i = 0; i < len; i++) { if (array[i] != '\0') { array[index++] = array[i];
for (int j = i + 1; j < len; j++) { if (array[j] == array[i]) { array[j] = '\0'; } } } } array[index] = '\0'; int k = 0; StringBuffer sb = new StringBuffer(); while (array[k] != '\0') { sb.append(array[k++]); } System.out.println(sb.toString());