Basically, i'm doing an exercise that requires me to decrypt some numbers in an array, which will then read out something about "THEO", i've written my code out in this way, and it compiles fine, but it's having a problem when i run it, i'm getting a problem with my parseInt function and it's giving me a number format exception, caught the exception and it gives me no details as to where it's tripping up, how can i fix this to work properly?

public class Decryption
{
    public static String code = "162 184 190 105 172 170 183 105 188 174 174 105 157 177 174 184 105 192 178 189 177 105 171 181 184 183 173 105 183 170 189 190 187 170 181 105 177 170 178 187 105 170 189 105 177 189 189 185 131 120 120 192 192 192 119 189 177 174 184 172 177 170 187 178 188 180 194 187 178 170 172 184 190 119 183 174 189 120 189 174 182 185 184 187 170 187 194 120 170 176 174 152 175 146 183 183 184 172 174 183 172 174 119 179 185 176";
    public static void main (String args[])
    {
        int output;
        String[] decryptArray=code.split("");
        char[] charCode= new char[decryptArray.length];
        for(int i = 0; i<92;i++)
        {
            for(int j = 0;j<decryptArray.length;j++)
            {
                charCode[j] = (char) (Integer.parseInt(decryptArray[j])-i);
            }

            String decrypt = String.copyValueOf(charCode);
            decrypt=decrypt.toUpperCase();
            if(decrypt.indexOf("THEO")>1)
            {
                System.out.print("The Key:"+i+"");
                System.out.print(charCode);
            }
        }
    }
}

Line 7 is that a "" or a " " ?
When you get bugs like this try printing your working variables at key stages in the code, eg if you printed the contents of decryptArray, or even just decryptArray.length, that would confirm whether or not your split was working.

commented: What a legend +1

Glad to help. Please mark this thread "solved"
J

Glad to help. Please mark this thread "solved"
J

Already on it ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.