Integer[] attr = {1, 8, 5, 6, 0, 7, 9};
Integer[] telNum = {5, 1, 5, 5, 5, 4, 3, 1, 6, 2, 0};
StringBuilder phone = new StringBuilder();
Arrays.sort(attr, (a, b) -> {
if (a < b) {
return 1;
} else if (a > b) {
return -1;
}
return 0;
});
for (Integer i : telNum) {
phone.append(attr[i]);
}
System.out.println("My Phone is: " + phone);
网友评论