title: String to byte convertion in java
body: <p>i m new in java....i m trying to read a text file using file input stream. i m reading text line by line and set as a string.. now i want to convert string into byte. but i m getting a number format exception.. please help me to solve this problem.</p>
  
  <pre><code>FileInputStream fstream = new FileInputStream("C:/Users/data.txt");
  
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            byte[] bytes = null;
            String str;
            int i=0;
  
            while ((str = br.readLine()) != null) 
            {
  
                bytes[i] = Byte.parseByte(str,16);
                i++;
            }
  
            in.close();
  </code></pre>