Ahoj napsal jsem to takto, ale nefunguje mi to poradi nekdo?
if(args.length > 0) {
try {
BufferedReader bfr = new BufferedReader(new FileReader(args[0]));
BufferedWriter bfw = new BufferedWriter (new FileWriter("vystup.txt"));
String radek;
while((radek = bfr.readLine())!= null) {
int nacteneCislo = Integer.parseInt(radek);
List<Integer> vytvorenePole = vytvorPole(nacteneCislo);
int[] prevedenePole = prevedPole(vytvorenePole);
selectSort(prevedenePole);
bfw.write("" + vytvorenePole.size() + "" + vytvorenePole.toString());
bfw.write("" + prevedenePole.length + "" + Arrays.toString(prevedenePole));
bfw.newLine();
}
bfr.close();
bfw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
debug:
Zadej dvouciferne cislo:
vstup.txt
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:909)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.nextInt(Scanner.java:2160)
at java.util.Scanner.nextInt(Scanner.java:2119)
at Ppa1_SP_A12B0046K.Ppa1_SP_A12B0046K.vstupCisla(Ppa1_SP_A12B0046K.java:26)
at Ppa1_SP_A12B0046K.Ppa1_SP_A12B0046K.main(Ppa1_SP_A12B0046K.java:151)
Java Result: 1