You can read an a binary file using this piece of code in all recent versions of Java:
File file = new File("path_to_the_file");
byte[] data = new byte[(int) file.length()];
DataInputStream stream = new DataInputStream(new FileInputStream(file));
stream.readFully(data);
stream.close();
If you are using Java 7 or later, there is a simpler way using the nio API
:
Path path = Paths.get("path_to_the_file");
byte [] data = Files.readAllBytes(path);