title: Reading from a binary file to byte array in j2me
body: <p>I use below method for reading a binary file :</p>
  
  <pre><code>public void readFile()
  {
      try
      {
          Reader in = new InputStreamReader( this.getClass().getResourceAsStream( this.fileName));
          int count = (in.read() * 0xFF) + in.read();
          int heights = in.read();
  
          this.shapes = new int[count][];
          for(int ii = 0;ii&lt;count;ii++)
          {
              int gwidth = in.read();
              int[] tempG = new int[gwidth * heights];
              int len = (in.read() * 0xff) + in.read();
              for(int jj = 0;jj&lt;len;jj++)
              {
                  tempG[top++] = in.read() * 0x1000000;
              }
              this.shapes[ii] = tempG;
          }
          in.close();
  
      }catch(Exception e){}
  }
  </code></pre>
  
  <p>It works perfectly in netbeans emulator and some devices,but in some devices and in <a href="http://www.javaemulator.com/java-emulator.php" rel="nofollow">kemulator</a> it seems that in.read(), read a char (two byte), and it causes my app crashes on those device and emulator.</p>
  
  <p>what is the best method for reading file in bytes?</p>