Tpotify.java
/**
     * Find the most played genre in the given list.
     *
     * @param input The counting list for each genre
     * @return index of the most played genre
     */
Find the most played genre in the given list.

@param input The counting list for each genre
@return index of the most played genre
Find the most played genre in the given list . @param input The counting list for each genre @return index of the most played genre
public static int findMaximumIndex(int[] input) {
        int maxIndex = 0;
        if (input != null && input.length > 0) {
            for (int i = 0; i < input.length; ++i) {
                if (input[i] > input[maxIndex]) {
                    maxIndex = i;
                }
            }
            return maxIndex;
        }else {
            return -1;
        }
    }
public static int findMaximumIndex ( int [ ] input ) { int maxIndex = 0 ; if ( input != null && input . length > 0 ) { for ( int i = 0 ; i < input . length ; ++ i ) { if ( input [ i ] > input [ maxIndex ] ) { maxIndex = i ; } } return maxIndex ; } else { return - 1 ; } }
Find the most played genre in the given list.
Find the most played genre in the given list .