tableau en java rempli par fichier
bonjour
j'arrive pas a mettre les donnée dans le tableau
me fais une erreur
3B Exception in thread "main" java.lang.NullPointerException
at test_2/test_2.test_3.main(test_3.java:20)
l'erreur ligne 20 est juste apres le j++
ligne vide ...
je comprend pas
merci est bonne année 2019
ps: la la ligne 1 est vide ,mais c'est package qui est ligne 1 sur eclipse.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package test_2;
import java.io.FileInputStream;
public class test_3 {
public static void main(String[] args) throws Exception {
FileInputStream fis = new FileInputStream("/home/toshiba/Documents/test.bin");
int tableau[] = null, i; // CREATION DU TABLEAU A 1 DIMENSIONS
int j = 1;
int count = 0;
while ((i = fis.read()) != -1) {
if (i != -1) {
System.out.printf("%02X ", i);
count++;
}
tableau [j] = i;
j++;
if (count == 16) {
System.out.println("");
count = 0;
}
}
fis.close();
}
} |