title: Reading a binary file into byte array
body: <p>I need to read a binary file and save each byte into a byte array. I've read other stackoverflow posts on this topic, but cannot figure out why mine does not work. Here is what I have:</p>
  
  <pre><code>String fileOne = "file1.bin";
  byte[] byteArray = new byte[1000];
  try{
      FileInputStream fileIS = new FileInputStream(fileOne);
      ObjectInputStream is = new ObjectInputStream(fileIS);
      is.read(byteArray);
      is.close();
      for(int i =0; i &lt; byteArray.length; i++){
          System.out.println(byteArray[i]);
      }
  }
  catch (FileNotFoundException e){
      e.toString();
      System.exit(0);
  }
  catch (IOException io){
      io.toString();
      System.exit(0);
  }
  </code></pre>