Java编程题:删除整数n中m个数字,使余下的数字按原次序最大
import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; public class C { public static void main(String[] args) { String s = "92081346718538"; int m = 10; int[] arr = new int[s.length()]; for(int i=0;i<s.length();i++){ arr[i] = Integer.parseInt(String.valueOf(s.charAt(i))); } System.out.println(Arrays.toString(arr)); int[] arr2 = arr.clone(); Arrays.sort(arr2); for(int j=0;j<m;j++) { arr = ArrayUtils.removeElement(arr, arr2[j]); } System.out.println(Arrays.toString(arr)); } }