I can't seem to find a way to read data from a file into a byte array. I saved the file using:
DataOutputStream dos = new DataOutputStream(new FileOutputStream(filechooser.getSelectedFile()));
for(int i = 0; i < bytearray.length; i++)
dos.writeByte((int) bytearray);
I need to be able to read the data back into an array, but the DataInputStream.readFully(byte[]); just throws a NullPointerException because I can't initialize the byte array to hold all the bytes in the file, because I don't know how many bytes are in the file (and I'm not sure how to find out...).