title: Reading a file into a byte-array with padding for 8-byte alignment - Java
body: <p>I need to read a file into a byte array in Java.  Fortunately, <a href="https://stackoverflow.com/questions/858980/file-to-byte-in-java">this question</a> has been answered very well, and I am able to use the nio libraries from Java 7.</p>
  
  <p>Here's the twist though: The resulting byte array needs to have a size which is a multiple of 8.  The extra bytes should be null, i.e. \0.</p>
  
  <p>Is there a quick and readable way to pad the byte array with zeros so that its size is a multiple of 8?  Note that readability and speed of development is key here - if the best solution adds more than a few lines in addition simply reading the file into a byte array, I'd rather simply copy the entire buffer into a new array.</p>
  
  <p>Edit:</p>
  
  <p>A bit more reading suggests that I can modify <a href="https://stackoverflow.com/a/8432074/2362578">this answer</a> and simply round the size of the buffer to the next 8.  Any thoughts on the safety and/or effectiveness of this strategy?  I believe the bytes in the buffer beyond the end of the file will be initialized to zero and unaffected by the read - is that correct?</p>