我從txt檔案中插入數千個數字到清單中,我想每5個數字對它們進行排序.這是可能的,如果是的話,如何做到這一點?
public static void readFromFile(){
List putInList = new ArrayList();
int jNum;
TextIO.readFile("jokerNums.txt");//read from a spesific file.
try{
do{
jNum = TextIO.getInt();
putInList.add(jNum);
} while(!TextIO.eof());// Test whether the next character in
//the current input source is an end-of-file
}
catch(IllegalArgumentException e){
}
TextIO.put(putInList);
}
我已經在do {} while循環中嘗試了for循環,但是它的無限.
僅舉幾個插入的數字是9785.
先感謝您.