i get this error message when i try to break in 2 parts (with "break point" the character "@")
- part_fixed
part_user
a secret key "final key" saved as string.
service_codeEncrypted_key = new SecretKeySpec(service_codeEncrypted, 0, 8, "DES"); System.out.println(""); System.out.println("Secret code as secret key :" + service_codeEncrypted_key); System.out.println(""); String final_key = "service_codeEncrypted_key";//key has the form xxx.xxx.xxx.xxx@yyyyy String[] parts = final_key.split("@") ; String part_fixed = parts[0]; // xxx.xxx.xxx.xxx String part_user = parts[1]; // yyyy System.out.println(""); System.out.println("Service Code decrypted : " + new String(service_codeDecrypted)); // Print the decrypted Text System.out.println(""); // System.out.println("Code for the card : " + part_user); // Print the decrypted Text System.out.println("Finish!!!"); // Print the decrypted Text System.out.println("-----------------------------------------------------------------------------------"); // Print the decrypted Text System.out.println(""); System.out.println("");
The error as shown in the console in the following :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at JEncrytion.main(JEncrytion.java:182)
where line 182 is : String part_fixed = parts[0];
The acual key has the form xxx.xxx.xxxxxx.xxx@yyyyy, and i want all the x's in one part and all the y in the second one.
Any ideas?
parts(System.out.println(parts.length);) before accessing the array elements to see how many elements are there?