Here you can find the source of fromOrdinal(E[] values, int ordinal)
public static <E> E fromOrdinal(E[] values, int ordinal)
//package com.java2s; /* USE THIS FILE ACCORDING TO THE COPYRIGHT RULES IN LICENSE.TXT WHICH IS PART OF THE SOURCE CODE PACKAGE */ public class Main { public static <E> E fromOrdinal(E[] values, int ordinal) { return ordinal >= 0 && ordinal < values.length ? values[ordinal] : values[0]; }// w w w. j a va 2 s. co m }