Here you can find the source of getBigDecimalNotZero(ResultSet rs, String columnLabel)
public static BigDecimal getBigDecimalNotZero(ResultSet rs, String columnLabel) throws SQLException
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.math.RoundingMode; import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static BigDecimal getBigDecimalNotZero(ResultSet rs, String columnLabel) throws SQLException { BigDecimal bigDecimal = rs.getBigDecimal(columnLabel); if (bigDecimal == null || bigDecimal.compareTo(BigDecimal.ZERO) == 0) { return null; } else {/*from w w w. j a va2 s. co m*/ return bigDecimal; } } public static BigDecimal getBigDecimalNotZero(ResultSet rs, String columnLabel, int scale, RoundingMode roundingMode) throws SQLException { BigDecimal bigDecimal = rs.getBigDecimal(columnLabel); if (bigDecimal == null || bigDecimal.compareTo(BigDecimal.ZERO) == 0) { return null; } else { return bigDecimal.setScale(scale, roundingMode); } } public static BigDecimal getBigDecimal(ResultSet rs, String columnLabel) throws SQLException { BigDecimal bigDecimal = rs.getBigDecimal(columnLabel); if (bigDecimal != null) { return bigDecimal; } else { return null; } } public static BigDecimal getBigDecimal(ResultSet rs, String columnLabel, int scale, RoundingMode roundingMode) throws SQLException, ArithmeticException { BigDecimal bigDecimal = rs.getBigDecimal(columnLabel); if (bigDecimal != null) { return bigDecimal.setScale(scale, roundingMode); } else { return null; } } }