Java - Write code to Return self prefixed by "a " or "an " according to a simple (and therefore inadequate) heuristic

Requirements

Write code to Return self prefixed by "a " or "an " according to a simple (and therefore inadequate) heuristic

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String self = "book2s.com";
        System.out.println(aan(self));
    }//from w w  w .j a v  a  2 s  . c  om

    /**
     * Return self prefixed by "a " or "an " according to a simple (and
     * therefore inadequate) heuristic, but good enough for cheezy uses.
     * <p/>
     * Note that this routine is not expected to internationalize well.
     */
    static public String aan(String self) {
        char c = Character.toLowerCase(self.charAt(0));
        if (1 <= self.length() && -1 != "aeiouh".indexOf(c)) {
            return "an " + self;
        } else {
            return "a " + self;
        }
    }
}

Related Exercise