public static void main(String[] args) {
int size = 6;
List tempList = new ArrayList<>();
List handledIndexList = new ArrayList<>();
handledIndexList.add(0);
handledIndexList.add(3);
// handledIndexList.add(5);
// 1 6
int emp = 0;
for (int i = 0; i < handledIndexList.size(); i++) {
//计算坐标查
if (handledIndexList.get(i) - emp >= 2) {
tempList.add(new int[]{emp, handledIndexList.get(i) - 1});
}
emp = handledIndexList.get(i) + 1;
}
if (size - handledIndexList.get(handledIndexList.size() - 1) - 1 >= 2) {
tempList.add(new int[]{handledIndexList.get(handledIndexList.size() - 1) + 1, size - 1});
}
for (int[] ints : tempList) {
System.out.println(ints[0] + "-" + ints[1]);
}
}