title: Efficient way to split a byte array to map the fields in a java class object
body: <p>Is there a more efficient way to break the data in a byte array in Java?
  I have written the following function to read a binary file with fixed length data field. But the performance are really slow, I need to read a binary file with 30,000 records each with the length of 300 bytes, and each record contain 240 fields.
  Any advise?</p>
  
  <pre><code>public void breakField(byte[] input) {
  
      ByteArrayInputStream bais = new ByteArrayInputStream(input);
  
      byte[] tmp = new byte[2];
      bais.read(tmp);
      this.id = new String(tmp);
  
      tmp = new byte[4];
      bais.read(tmp);
      this.name = new String(tmp);
  
      tmp = new byte[8];
      bais.read(tmp);
      this.phone = new String(tmp);
  
      tmp = new byte[15];
      bais.read(tmp);
      this.otherInfo = new String(tmp);
  
      .... more fields...
  
  }       
  </code></pre>