title: Numbers in a file
body: <p>I'm just a beginner and got the following task:</p>
  <p><em>Write first 100 positive and 100 negative integers to the file, listing them separated by a space.
  Then read this file and put the read numbers into 2 files: positive_numbers and negative_numbers.</em></p>
  <pre><code>public static void main(String[] args) throws IOException {
          File numbers = new File(&quot;C:\\numbers.txt&quot;);
          File positivNumbers = new File(&quot;C:\\positivnumbers.txt&quot;);
          File negativNumbers = new File(&quot;C:\\negativnumbers.txt&quot;);
  
  
          try (
                  BufferedWriter wr = new BufferedWriter(new FileWriter(numbers));
                  BufferedReader rd = new BufferedReader(new FileReader(numbers));
                  BufferedWriter brnegativ = new BufferedWriter(new FileWriter(negativNumbers));
                  BufferedWriter brpositiv = new BufferedWriter(new FileWriter(positivNumbers));) {
  
              if (numbers.exists()) {
                  for (int i = 0; i &lt;= 100; i++) {
                      wr.write(String.valueOf((i) + &quot; &quot;));
                  }
                  for (int a = -1; a &gt;= -100; a--) {
                      wr.write(((a) + &quot; &quot;));
                  }
  
                  String line = rd.readLine();
                  while (line != null) {
                      brpositiv.write(line);
                  }
  
              }
          } catch (FileNotFoundException e) {
              e.printStackTrace();
      }
  }
  </code></pre>
  <p>I could write numbers as a String to file &quot;numbers&quot;. But I cannot read and write them in &quot;positiv&quot;   output file.The file is empty. Where is my mistake?</p>