我想问一下为啥我运行结果不对啊(DNA的汉明距离问题)

已经从txt文件里面读取出来五个dna序列了

for(int i=0;i<8;i++) {
int countA=0;
int countT=0;
int countG=0;
int countC=0; //每个位置循环过后要清零

              for(int j=0;j<m;j++) {
                  //对每个序列每个位置上的字母进行统计
                  if(s[j].charAt(i)=='A') {
                      countA++;
                      }
                  if(s[j].charAt(i)=='T') {
                      countT++;
                      }
                  if(s[j].charAt(i)=='G') {
                      countG++;
                      }
                  if(s[j].charAt(i)=='C') {
                      countC++;
                      }
              }
    optimal+=max(countA,countG,countT,countC);
      //输出字符串
      
      }
        System.out.println("the optimal sequence is:");
        System.out.println(optimal);

}
private static char max(int countA, int countC, int countG, int countT) {
//比较每一位重复最多的字母 并返回字母
for(int k=0;k<4;k++) {
int a[]=new int[4];
a[0]=countA;
a[1]=countC;
a[2]=countG;
a[3]=countT;
int max=a[0];
for(int i=1;i<4;i++) {
if(a[i]>max) {
max=a[i];
}
}
if(max==countA) {
return 'A';
}
else if(max==countC) {
return 'C';
}
else if(max==countG) {
return 'G';
}
else if(max==countT) {
return 'T';
}

      }
return ' '; 

    
  }
       

}

为啥要for(int k=0;k<4;k++) 这层循环呢???

private static char max(int countA, int countC, int countG, int countT) 
{
    int m1 = countA > countC ? countA:countC;
    int m2 = countG > countT ? countG:countT;
    int m = m1 > m2 ? m1:m2;
    switch(m)
    {
        case countA:
            return 'A';
        case countC:
            return 'C';
        case countG:
            return G;
        case countT:
            return T;
    }
    return ' ';
}