The Problem I have to do is as follows
public static String randomDNAString(int dnaLength) /** * @param dnaLength a non-negative int * @return a random String of length dnaLength comprised of the four chars A, T, G, and C */
I thought I did it correctly (though incredibly inefficiently) but it doesn't return anything. Here's my code. Any help is appreciated.
public static String randomDNAString(int dnaLength){
Random rand = new Random();
char[] dna;
dna = new char[dnaLength];
for(int i = 0; i<dnaLength;i++){
int tempC = rand.nextInt(4);
if(tempC == 0)
dna[i] = 'A';
if(tempC == 1)
dna[i] = 'G';
if(tempC == 2)
dna[i] = 'C';
if(tempC == 3)
dna[i] = 'T';
}
return (java.util.Arrays.toString(dna));
}
[A, G, G, G, A, G, G, C, A, A]print()call. Where is yourmain()method? What does it do?