I am writing a program that needs to convert every three characters into a corresponding value, this means I need to store every three characters of the string into an array, I am unsure how to approach this, any ideas?
A friend showed me a brute force method;
Scanner kb = new Scanner(System.in);
String input = kb.next();
int n = input.length()/3;
String[] num = new String[n];
for(int i = 0, x=0, y=3; i<n; i++){
num[i] = input.substring(x,y);
x += 3;
y += 3;
System.out.println(num[i]);
}