public static int lastIndexOf ( double [ ] array , double val ) { for ( int i = array . length - 1 ; i >= 0 ; i -- ) { if ( array [ i ] == val ) { return i ; } } return - 1 ; }
Gets the last index of a given value in an array or - 1 if not present .