Javaプログラマーのための三人称単数現在のS

public class ThirdPersonSingularPresent {
    
public final static String[] IRREGULAR_O={"coo","woo"};
public final static String[] ES_GROUP={"s","ch","sh","x"};
public final static String S="s";
public final static String ES="es";
public final static String IES="ies";

public final static String attachS(String word){
    
    if(word.endsWith("o")){
    for(int i=0;i<IRREGULAR_O.length;i++){
        if(word.equals(IRREGULAR_O[i])){
            return word+S;
        }
        
    }
    return word+ES;
    }
    
    for(int i=0;i<ES_GROUP.length;i++){
        if(word.endsWith(ES_GROUP[i])){
            return word+ES;
        }
    }
    
    if(word.endsWith("y") && !word.endsWith("ay")  && !word.endsWith("ey") && !word.endsWith("iy") && !word.endsWith("oy") && !word.endsWith("uy")){
        return word.substring(0,word.length()-1)+IES;
    }
    
    
    return word+S;
}

}