title: displaying the output of ByteArrayOutputStream as integer
body: <p>the resulting output in the file fos1.txt is  d but i want it ti be 100 in the file , how can i do that?</p>
  
  <pre><code>public class Byteo {
  
      public static void main(String[] args) {
  
          try {
              FileOutputStream fos1 = new FileOutputStream("G:\\fos1.txt");
  
  
              ByteArrayOutputStream bos = new ByteArrayOutputStream();
          int x = 100;
  
              bos.write(x);       
  
  
              try {
  
                  bos.writeTo(fos1);
  
                  bos.flush();
                  bos.close();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
  
          } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
  
      }
  
  }
  </code></pre>