How could I have every three letters of this string: ATGCCACTATGGTAG
to be saved in an array, with a comma separating every three letters.
This is what I have:
The parameter sequence is the above jumble of letters.
public static void listCodons(String sequence){
int length = sequence.length();
String[] listOfCodons = new String[length];
for(int i = 0; i< length; i++){
//This is where I'm not sure what to do
listOfCodons = sequence[i]+sequence[i+1]+sequence[i+2];
}
}
System.out.print(Arrays.toString(listOfCodons));
}