I wanted to print out 1 000 000 000 to 1 999 999 999. I thought it would be an easy task but eclipse tells me something about memory error. How could I do this? I want to have a text data where all numbers from 1000000000 to 1999999999 are written down each in a new line. I thought printing them out in the console and then just copy & paste into a .txt data would work, but it sadly doesn't.
My code:
public static void main(String[] args) {
int number = 1000000000;
do {
System.out.println(number);
number = number +1;
} while (number < 2000000000);
}
How would you fix this problem? Please help me.