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.

[3183 byte] By [sys5a] at [2007-11-27 9:11:32]
# 1
> I am trying to run an infinite loop to create an> extremely long number that is written to a single> text file.why do you want to do this? infinte loop implies an infinite number, or in the very least a method that will make java crash.
petes1234a at 2007-7-12 21:57:11 > top of Java-index,Java Essentials,New To Java...
# 2
I have an old crappy computer and I am trying to see how large the file will get before it crashes/runs out of memory.
sys5a at 2007-7-12 21:57:11 > top of Java-index,Java Essentials,New To Java...
# 3
> I have an old crappy computer and I am trying to see> how large the file will get before it crashes/runs> out of memory.i have a feeling i know where this is going. you're on your own here.
petes1234a at 2007-7-12 21:57:11 > top of Java-index,Java Essentials,New To Java...