package Captain_Ship.alphanum;
import org.apache.commons.lang3.ArrayUtils;
import java.util.Arrays;
public class A2N {
public static String main(String input) {
char[] alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y','z'};
String output = "";
char[] input_char = input.toLowerCase().toCharArray();
int[] output_int = {};
//Still doesn't work. outputs [I@123772c4 in place of 8 5 12 12 15
for (int i = 0; i>input_char.length; i++) {
output_int[i] = ArrayUtils.indexOf(alphabet,input_char[i]);
}
output = Arrays.toString(output_int);
return output;
}
}
This is my code. It is super simple with its goal. Take a sentence and translate each letter into a number. So A would be 1, B would be 2, etc. I have tried everything to try and get the loop to work as I want it to. This piece of code is currently the only version which gave me something other than something similar to this: [I@123772c4. I have run out of the options I have researched.