title: readLine() null return
body: <p>I have the following code:</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      String s = "";
      StringBuilder sb = new StringBuilder();
      File file = new File("C:\\New\\r.txt");
  
      BufferedReader in = new BufferedReader(new FileReader(file));
      while(in.readLine() != null) {      
          sb.append(in.readLine());
      }
  
      System.out.println(sb);
      s = sb.toString();
      byte[] b = s.getBytes();
  
     for(int i = 0; i &lt; b.length; i++) {
         if(b[i] == 1){ b[i]=0; }
         if(b[i] == 0){ b[i]=1; }
     }
  
     FileOutputStream fos = new FileOutputStream(file);
     DataOutputStream dos = new DataOutputStream(fos);
     dos.write(b);
     in.close();
     fos.close();
     dos.close();
  }
  </code></pre>
  
  <p>I get a return of null when I run this program. Maybe I must elevate the program? Help would be appreciated.</p>