Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   java - print numbers as word equivalent but in reverse (http://www.go4expert.com/forums/java-print-word-equivalent-reverse-t26647/)

javanewbie 9Sep2011 02:14

java - print numbers as word equivalent but in reverse
I am working on a program in java on notepad++ that opens a file(reverse.in) opens it and extracts the integers to an array. Now I need convert the numbers to words and print them out in reverse. For example 0 1 2 3 would become three two one zero.

I have the array set but have no idea how to convert the numbers and print in reverse. This is only my 3rd week of java so the more info the better!!!

import java.util.*;
import java.io.*;
public class Reverse1{
public static void main(String[] args) throws Exception{
int i =0;
File file = null;
 file = new File("Reverse.in");
 BufferedReader bufRdr  = new BufferedReader(new FileReader(file));
 String line = "";
 String [] numbers = new String[10];
  while ((line = bufRdr.readLine()) != null){

  StringTokenizer st = new StringTokenizer(line,",");
while (st.hasMoreTokens()) {
numbers[i]= st.nextToken();

for (i = 1; i < numbers.length; i++) { 
System.out.print("" + numbers[i]);


All times are GMT +5.5. The time now is 03:41.