Web Analytics Made Easy -
StatCounter Take numbers from array, turn into their word equivalent and print in reverse - CodingForum

Announcement

Collapse
No announcement yet.

Take numbers from array, turn into their word equivalent and print in reverse

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Take numbers from array, turn into their word equivalent and print in reverse

    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();
    }
    i++;
    }

    for (i = 1; i < numbers.length; i++) {
    System.out.print("" + numbers[i]);
    System.out.println();
    }
    System.out.println();
    }
    }
Working...
X
😀
🥰
🤢
😎
😡
👍
👎