Estou tentando armazenar um valor no vetor mas ele só fica null.
Tenho um arquivo texto com Strings e inteiros e tento separar eles para poder ordena-los, mas está dando erro ao inserir no vetor.
O modelo do Arquivo texto é
A 4
O 6
I 2
M 8
U 4
V 2
E 4
N 3
S 1
W 7
o codigo é
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Gustavo
*/
import java.util.Scanner;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Caixas {
public static void main(String[] args) throws FileNotFoundException{
int tam_caixa;
int i=0, j = 0;
Scanner in = new Scanner(System.in);
System.out.println("Entre com o tamanho da caixa");
tam_caixa = Integer.parseInt(in.nextLine());
int [] id = new int[tam_caixa];
String [] cx = new String[tam_caixa];
FileReader fl = new FileReader("C:\\temp\\objetos.txt");
BufferedReader on = new BufferedReader(fl);
String s;
try {
while ((s = on.readLine()) != null) {
String resul[] = s.split(" ");
cx[i]= resul[0];
id[j] = Integer.valueOf((resul[1]));
i++;j++;
}
for(int l =0; l<=tam_caixa; l++){
System.out.println(id[l]+" "+ cx[l]);}
} catch (IOException ex) {
Logger.getLogger(Caixas.class.getName()).log(Level.SEVERE, null, ex);
}
}
}