static Object getIndexObject ( double d ) { int i = ( int ) d ; if ( i == d ) { return Integer . valueOf ( i ) ; } return toString ( d ) ; }
If d is exact int value return its value wrapped as Integer and othewise return d converted to String .