Code example for BigDecimal

Methods: add

0
				return null; 
			 
			// unfortunately none of the RoundingMode's in BigDecimal are compatible with XQuery 
			// definition (or Math.round(double)). BigDecimal.ROUND_UP rounds -2.5 to -3 (rounds 
			// in scales without considering sign) 
			return args[0].add( HALF ).setScale( 0, BigDecimal.ROUND_FLOOR ).stripTrailingZeros();
		} 
 
		public BigInteger apply(BigInteger... args) {
			if ( args.length != 1 )
				return null; 
			 
			return args[0];
		} 
 
		public Double  apply(Double... args) {
			if ( args.length != 1 )
				return null; 
			 
			return Double.valueOf( Math.round( args[0] ) );
Contextual code suggestions in your IDE  Get Codota for Java