My Phone

2018-05-15  本文已影响43人  冯文议
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);
上一篇下一篇

猜你喜欢

热点阅读