Problem with Decoding

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • UnLinux
    New Member
    • Oct 2006
    • 1

    Problem with Decoding

    I am writing a program class to decode a string of input from a user. I need it to take the integer and return the ASCII charcater coresponding to that int. (i.e. 77=M). Belwo is the code I have so far. Can someone lead me in the right direction to correct my code?

    Code:
    /*LetterDecode class for LetterCode main program*/
    
    import tio.*;    //uses the tio package from the book
    import java.lang.*; // for length
    import java.util.*; //for the search utilities
    
    class LetterDecode {
        public static void main(String[] arguments) {
            String d;
            int [] buffer;
            int d;
                            
            System.out.print("What is your message you wish to decode? (Numbers & Spaces Only): ");
                d = Console.in.readLine();
                buffer = d.toIntArray;
                for (int i = 0; i < d.length(); i++)
                System.out.print(integer.parseInt(buffer[i] + " "));
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    Code:
    int i = 77;
    String s = "";
    s += i;
    System.out.println(s);
    It is already implemented. I think you can call it explicitly as i.toString().

    Comment

    Working...