strings/Alphabetical.java
/**
     * Check if a string is alphabetical order or not
     *
     * @param s a string
     * @return {@code true} if given string is alphabetical order, otherwise {@code false}
     */
Check if a string is alphabetical order or not
@param s a string
@return  true if given string is alphabetical order, otherwise  false
Check if a string is alphabetical order or not @param s a string @return true if given string is alphabetical order otherwise false
public static boolean isAlphabetical(String s) {
        int n = s.length();   
        char c[] = new char [n];  
        for (int i = 0; i < n; i++) {  
            c[i] = s.charAt(i);  
        }   
        Arrays.sort(c);   
        for (int i = 0; i < n; i++)  
            if (c[i] != s.charAt(i))   
                return false;
        return true;
    }
public static boolean isAlphabetical ( String s ) { int n = s . length ( ) ; char c [ ] = new char [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = s . charAt ( i ) ; } Arrays . sort ( c ) ; for ( int i = 0 ; i < n ; i ++ ) if ( c [ i ] != s . charAt ( i ) ) return false ; return true ; }
Check if a string is alphabetical order or not
 @param s a string
 @return {@code true} if given string is alphabetical order, otherwise {@code false}
Check if a string is alphabetical order or not @param s a string @return { @code true } if given string is alphabetical order otherwise { @code false }