I've used this topic: File to byte[] in Java Here is my code:
try {
Path path1 = Paths.get(path + fileName);
byte[] fileAsByte = Files.readAllBytes(path1);
System.out.println("Byte : " + fileAsByte.toString());
} catch (FileNotFoundException e) {
System.out.println("File Not Found.");
e.printStackTrace();
} catch (IOException e1) {
System.out.println("Error Reading The File.");
e1.printStackTrace();
} catch (OutOfMemoryError e3) {
System.out.println("Out of Memory");
e3.printStackTrace();
}
This code is not triggering any exception, but the output is still:
Byte : [B@60f17a2f
Which seems pretty invalid to me. I'm pretty sure I did a dumb error, but it's been three hours that I've been trying to resolve it, and I could use some fresh eyes on it.
Thanks.