Hadean Fall's Profile User Rating: -----

Reputation: -5 Shunned
Group:
Active Members
Active Posts:
223 (0.14 per day)
Joined:
05-September 11
Profile Views:
3,707
Last Active:
User is offline Mar 19 2014 03:39 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   Hadean Fall do ur wurst

Posts I've Made

  1. In Topic: Converting letters to numbers easily

    Posted 27 Feb 2014

    so im getting a loss of precision error with my code
    import java.util.*;
    public class caesarcipher {
    
    
            public static void main (String args[]) {
                    Scanner in = new Scanner(System.in);
                String message;
                    char key = 3;
                    char num = 26;
    
                    System.out.println("please input your message to be encoded");
                    message = in.next();
                    System.out.println("please input the key");
    
                    message = message.toLowerCase();
                    char[] encrypt = message.toCharArray();
                    char[] ans = new char[message.length()];
    
                    for (int count = 0; count <= message.length(); count++)
                    {
                    ans[count] = (encrypt[count] + key) % (char) num;
                            System.out.println(count);
                    }
    
            }
    }
    
    

    i don't understand how, it says its in this line
    ans[count] = (encrypt[count] + key) % (char) num;
    
    
  2. In Topic: Converting letters to numbers easily

    Posted 27 Feb 2014

    so could i use .charAt to read a string into a char array then convert that to numbers?
  3. In Topic: Converting letters to numbers easily

    Posted 27 Feb 2014

    ok thank you, but if i wanted to convert an entire string to numbers such as "helloworld" how would i go about that? Would i have to take substrings for each individual letter, convert it to a char put it in an array then convert the array to numbers? or is there a shortcut i can take

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Page 1 of 1
  1. Photo

    brep Icon

    18 Sep 2011 - 14:53
    Thanks you so much for the positive rep. I greatly appreciate it :)
Page 1 of 1