Here you can find the source of subUlp(BigDecimal x)
public static BigDecimal subUlp(BigDecimal x)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.BigInteger; public class Main { public static BigDecimal subUlp(BigDecimal x) { BigInteger unscaledValue = x.unscaledValue(); unscaledValue = unscaledValue.subtract(BigInteger.ONE); return new BigDecimal(unscaledValue, x.scale()); }// ww w .j a va 2s. co m }