Creating long number issue
I am trying to run an infinite loop to create an extremely long number that is written to a single text file.
Here is what i have:
package count;
import java.io.*;
/**
* Summary description for Program
*/
publicclass Program
{
publicstaticvoid IO(int a)
{
FileOutputStream out;// declare a file output object
PrintStream p;// declare a print stream object
try
{
String filename ="Numbers";
int filecontent;
filecontent = a;
// Create a new file output stream
// connected to "myfile.txt"
out =new FileOutputStream(filename +".txt");
p =new PrintStream(out);
p.println(filecontent);
p.close();
}
catch (Exception e)
{
System.err.println("Error writing to file");
}
}
publicstaticvoid main(String[] args)
{
int x = 1;
System.out.println(x);
FileOutputStream out;// declare a file output object
PrintStream p;// declare a print stream object
String filename ="Numbers";
int filecontent = x;
// Create a new file output stream
// connected to "myfile.txt"
out =new FileOutputStream(filename +".txt");
p =new PrintStream(out);
while (0 < x){
try{
filecontent = x;
p.println(filecontent);
p.close();
}
catch (Exception e)
{
System.err.println("Error writing to file");
}
x++;
}
}
}
Help please.

