Estou tentando manipular um txt pois preciso ordenalo usando QuickSort, mas não consigo pois os numeros estão separados por “,” e toda vez que tento ler o TXT da problema
private static int[] leitor(String file){
try {
File f = new File(file);
Scanner s = new Scanner(f);
int ctr = 0;
while (s.hasNextInt()){
ctr++;
s.nextInt();
}
int[] arr = new int[ctr];
Scanner s1 = new Scanner(f);
for (int i = 0; i < arr.length; i++){
arr[i] = s1.nextInt();
}
return arr;
}catch (Exception e){
return null;
}
}
