This reminds me of programming my TI-55 years and years ago. It had 32 programmable instruction steps, and a RESET instruction that would jump to instruction zero, so simple looping could be implemented. The problem was getting it to stop, which boiled down to getting it to do an operation that caused an error, e.g., divide by zero.
Thus:
public static void main(String[] args)
{
printN(100);
}
private static void printN(int n)
{
try
{
int t = 1/n; // Exception when n is 0
printN(n-1); // Recurse, down to 0
System.out.println(n);
}
catch (Exception ex)
{
// Stop recursing
}
}
Note: Yes, I know this is similar to @Yacoby's solution.