This is another suggestion.
Convert the number to string then use the method length() to get the length of
the string
so you know the first number is going to be(thousand if the length equals to
4,...etc)
This is a part of the way i think about, and you can easly complete it.
String num = 1234 + ""; // convert the number to string
int len = num.length();
int n; // to store the number to be used in switch
for ( int i = 0; i < num.length(); i++)
n = Integer.parseInt(num.charAt(i));
swicth n
{ case 1:
System.out.print("one");
if (len = 4)
System.out.println("Thousand");
else if (len = 3)
System.out.println("Hundred"); else if (len = 2)
if (Integer.parseInt(num.CharAt(i+1)) == 0)
System.out.println("and ten");
else
switch(Integer.parseInt(num.CharAt(i+1))
case 1: System.out.print("eleven"); break;
case 2: ...............................etc.
else
System.out.print("one");
break;
case 2:
System.out.print("two");
if (len = 4)
System.out.println("Thousands");
else if (len = 3)
System.out.println("Hundreds"); else if (len = 2)
if (Integer.parseInt(num.CharAt(i+1)) == 0)
System.out.println("and twenty");
else
System.out.print("two");
break;
case 3: ............................... etc.
................................case 9: ..... break;
len--; }
you can handel some stuiations ( as if the number followed by zero like 1045 as
you want e.g: skip the 0 or any way you want)