public static double times ( double [ ] nums ) { if ( nums == null || nums . length == 0 ) return 0 ; double ret = 1 ; for ( int i = 0 ; i < nums . length ; i ++ ) ret *= nums [ i ] ; return ret ; }
This returns the product of all numbers in the given array .