title: How to write 1 to 1000 numbers into text file using java?
body: <p>I am fresher candidate. So how to write 1 to 1000 numbers into text file? I tried las below code but it writes as like ASCII values. unable to print as numbers so how to write as numbers?</p>
  
  <pre><code>    import java.io.FileOutputStream;
      public class FileWriterExample {
         public static void main(String args[]){
             try{
                 FileOutputStream fout=new FileOutputStream("D:\\trial.txt");
                 int i;
              for(i = 0; i&lt; 1000 ; i++) {
                  fout.write(i);
              }         
                 fout.close();
                 System.out.println("success...");
             }catch(Exception e){System.out.println(e);}
         }
  }
  </code></pre>