Example usage for java.math BigDecimal compareTo

List of usage examples for java.math BigDecimal compareTo

Introduction

In this page you can find the example usage for java.math BigDecimal compareTo.

Prototype

@Override
public int compareTo(BigDecimal val) 

Source Link

Document

Compares this BigDecimal with the specified BigDecimal .

Usage

From source file:net.shopxx.controller.shop.OrderController.java

@RequestMapping(value = "/calculate", method = RequestMethod.GET)
public @ResponseBody Map<String, Object> calculate(Long receiverId, Long paymentMethodId, Long shippingMethodId,
        String code, String invoiceTitle, BigDecimal balance, String memo) {
    Map<String, Object> data = new HashMap<String, Object>();
    Cart cart = cartService.getCurrent();
    if (cart == null || cart.isEmpty()) {
        data.put("message", ERROR_MESSAGE);
        return data;
    }//from  w  ww  . j a va 2s  .  c  o  m
    Member member = memberService.getCurrent();
    Receiver receiver = receiverService.find(receiverId);
    if (receiver != null && !member.equals(receiver.getMember())) {
        data.put("message", ERROR_MESSAGE);
        return data;
    }
    if (balance != null && balance.compareTo(BigDecimal.ZERO) < 0) {
        data.put("message", ERROR_MESSAGE);
        return data;
    }
    if (balance != null && balance.compareTo(member.getBalance()) > 0) {
        data.put("message", Message.warn("shop.order.insufficientBalance"));
        return data;
    }

    PaymentMethod paymentMethod = paymentMethodService.find(paymentMethodId);
    ShippingMethod shippingMethod = shippingMethodService.find(shippingMethodId);
    CouponCode couponCode = couponCodeService.findByCode(code);
    Invoice invoice = StringUtils.isNotEmpty(invoiceTitle) ? new Invoice(invoiceTitle, null) : null;
    Order order = orderService.generate(Order.Type.general, cart, receiver, paymentMethod, shippingMethod,
            couponCode, invoice, balance, memo);

    data.put("message", SUCCESS_MESSAGE);
    data.put("price", order.getPrice());
    data.put("fee", order.getFee());
    data.put("freight", order.getFreight());
    data.put("tax", order.getTax());
    data.put("promotionDiscount", order.getPromotionDiscount());
    data.put("couponDiscount", order.getCouponDiscount());
    data.put("amount", order.getAmount());
    data.put("amountPayable", order.getAmountPayable());
    return data;
}

From source file:UserInterface.FinanceRole.TransferToRegSiteJPanel.java

private void autoTransferJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoTransferJButtonActionPerformed

    //Validation/*from  w  ww .  j a  v  a 2 s  . com*/
    boolean validationSuccess;
    validationSuccess = validationAutoTansfer();

    if (validationSuccess) {

        objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();

        BigDecimal worldDonation = AutoTransfer.transferCheck(objWorldEnterprise, objUserAccount,
                autoDonationAmount);
        BigDecimal worldBalance = objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance();
        System.out.println(worldDonation);

        System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance());
        System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance());

        int positiveWorldBalance = worldBalance.compareTo(worldDonation);

        if (positiveWorldBalance >= 1) {
            JDialog.setDefaultLookAndFeelDecorated(true);

            int response = JOptionPane.showConfirmDialog(null,
                    "Total transfer of $ " + worldDonation + "/- Do you want to transfer?", "Confirm",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (response == JOptionPane.YES_OPTION) {
                System.out.println("Yes button clicked");
                worldDonation = AutoTransfer.transferConfirm(objWorldEnterprise, objUserAccount,
                        autoDonationAmount);

                JOptionPane.showMessageDialog(null, "$ " + worldDonation + "/- transferred successfully");

                autoTransferJTextField.setText(null);

                populateLowRegSiteTable();
            }
        } else {
            JOptionPane.showMessageDialog(null, "World Balance is low");
        }
    }
}

From source file:mx.edu.um.mateo.inventario.web.SalidaController.java

@RequestMapping("/ver/{id}")
public String ver(@PathVariable Long id, Model modelo) {
    log.debug("Mostrando salida {}", id);
    Salida salida = salidaDao.obtiene(id);
    switch (salida.getEstatus().getNombre()) {
    case Constantes.ABIERTA:
        modelo.addAttribute("puedeEditar", true);
        modelo.addAttribute("puedeEliminar", true);
        modelo.addAttribute("puedeCerrar", true);
        break;//from  w w  w . j  a  v a  2  s  . com
    case Constantes.CERRADA:
        modelo.addAttribute("puedeCancelar", true);
        modelo.addAttribute("puedeReporte", true);
        break;
    case Constantes.CANCELADA:
        log.debug("Puede ver reporte");
        modelo.addAttribute("puedeReporte", true);
        break;
    }

    modelo.addAttribute("salida", salida);

    BigDecimal subtotal = new BigDecimal("0").setScale(2, RoundingMode.HALF_UP);
    BigDecimal iva = new BigDecimal("0").setScale(2, RoundingMode.HALF_UP);
    for (LoteSalida lote : salida.getLotes()) {
        subtotal = subtotal.add(lote.getPrecioUnitario().multiply(lote.getCantidad()));
        iva = iva.add(lote.getIva());
    }
    BigDecimal total = subtotal.add(iva);
    modelo.addAttribute("subtotal", subtotal.setScale(2, RoundingMode.HALF_UP));
    modelo.addAttribute("iva", iva);
    modelo.addAttribute("total", total.setScale(2, RoundingMode.HALF_UP));
    if (iva.compareTo(salida.getIva()) == 0 && total.compareTo(salida.getTotal()) == 0) {
        modelo.addAttribute("estiloTotales", "label label-success");
    } else {
        BigDecimal variacion = new BigDecimal("0.05");
        BigDecimal topeIva = salida.getIva().multiply(variacion);
        BigDecimal topeTotal = salida.getTotal().multiply(variacion);
        log.debug("Estilos {} {} {} {} {} {}",
                new Object[] { iva, salida.getIva(), topeIva, total, salida.getTotal(), topeTotal });
        if (iva.compareTo(salida.getIva()) < 0 || total.compareTo(salida.getTotal()) < 0) {
            log.debug("La diferencia es menor");
            if (iva.compareTo(salida.getIva().subtract(topeIva)) >= 0
                    && total.compareTo(salida.getTotal().subtract(topeTotal)) >= 0) {
                modelo.addAttribute("estiloTotales", "label label-warning");
            } else {
                modelo.addAttribute("estiloTotales", "label label-important");
            }
        } else {
            log.debug("La diferencia es mayor {} {}",
                    new Object[] { iva.compareTo(salida.getIva().add(topeIva)),
                            total.compareTo(salida.getTotal().add(topeTotal)) });
            if (iva.compareTo(salida.getIva().add(topeIva)) <= 0
                    && total.compareTo(salida.getTotal().add(topeTotal)) <= 0) {
                log.debug("estilo warning");
                modelo.addAttribute("estiloTotales", "label label-warning");
            } else {
                log.debug("estilo error");
                modelo.addAttribute("estiloTotales", "label label-important");
            }
        }
    }

    return "inventario/salida/ver";
}

From source file:org.efaps.esjp.accounting.util.data.ImportDetails.java

protected List<Document> checkAccounts(final Parameter _parameter, final File _file,
        final Map<String, Instance> _docMap, final DateTime _date, final Boolean _inverse)
        throws IOException, EFapsException {
    final List<Document> ret = new ArrayList<>();
    final CSVReader reader = new CSVReader(new InputStreamReader(new FileInputStream(_file), "UTF-8"));
    final List<String[]> entries = reader.readAll();
    reader.close();/*from   w w  w .  j ava 2s . c om*/
    entries.remove(0);
    int i = 1;
    final Map<String, Document> map = new HashMap<>();
    for (final String[] row : entries) {
        i++;
        final String docNumber = row[0];
        final String ruc = row[1];
        final String dateStr = row[2];
        final String accountStr = row[5];
        final String accountDesc = row[4];
        final DecimalFormat formater = (DecimalFormat) NumberFormat.getInstance(Locale.GERMAN);
        formater.setParseBigDecimal(true);
        final String amountMEStr = row[6];
        final String amountMNStr = row[7];

        final QueryBuilder queryBldr = new QueryBuilder(CIAccounting.AccountAbstract);
        queryBldr.addWhereAttrEqValue(CIAccounting.AccountAbstract.Name, accountStr.trim());
        final InstanceQuery query = queryBldr.getQuery();
        query.executeWithoutAccessCheck();
        if (query.next()) {
            ImportDetails.LOG.info("Found account: '{}' ", accountStr);
            final String[] docSplit = docNumber.split("-");
            if (docSplit.length != 2 && _docMap != null) {
                ImportDetails.LOG.warn(
                        "Document '{}'  - Line: {} has no '-' to distinguish SerialNumber and No.", docNumber,
                        i);
            } else {
                try {
                    final Formatter criteria = new Formatter();
                    String name = docNumber;
                    if (_docMap != null) {
                        final String serialNo = docSplit[0];
                        final String docNo = docSplit[1];
                        final int serial = Integer.parseInt(serialNo.trim().replaceAll("\\D", ""));
                        final int no = Integer.parseInt(docNo.trim().replaceAll("\\D", ""));
                        criteria.format("%03d-%06d", serial, no);
                        name = criteria.toString();
                    }

                    Document doc;
                    if (map.containsKey(name)) {
                        doc = map.get(name);
                    } else {
                        if (_docMap != null && _docMap.containsKey(name)) {
                            doc = new Document(name, _docMap.get(name), ruc, dateStr, accountDesc);
                        } else {
                            doc = new Document(name, null, ruc, dateStr, accountDesc);
                        }
                    }

                    BigDecimal amountME = (BigDecimal) formater.parse(amountMEStr);
                    BigDecimal amountMN = (BigDecimal) formater.parse(amountMNStr);

                    if (_inverse) {
                        amountME = amountME.negate();
                        amountMN = amountMN.negate();
                    }

                    if (amountMN.compareTo(BigDecimal.ZERO) >= 0) {
                        doc.addAmountMECredit(amountME);
                        doc.addAmountMNCredit(amountMN);
                    } else {
                        doc.addAmountMEDebit(amountME);
                        doc.addAmountMNDebit(amountMN);
                    }

                    final Map<String, Account> accounts = doc.getAccounts();
                    Account acc;
                    if (accounts.containsKey(accountStr)) {
                        acc = accounts.get(accountStr);
                    } else {
                        acc = new Account(accountStr, accountDesc);
                        accounts.put(accountStr, acc);
                    }
                    acc.addAmountME(amountME);
                    acc.addAmountMN(amountMN);
                    acc.setInstance(query.getCurrentValue());

                    map.put(name, doc);

                    criteria.close();
                } catch (final NumberFormatException e) {
                    ImportDetails.LOG.error("wrong format for document '{}'", docNumber);
                } catch (final ParseException e) {
                    ImportDetails.LOG.error("wrong format for amounts '{}' - '{}'", amountMEStr, amountMNStr);
                }
            }
        } else {
            ImportDetails.LOG.error("Not found account: {}", accountStr);
        }
    }

    final Instance periodInst = getPeriodInstance();
    for (final Document doc : map.values()) {
        final BigDecimal amountCreditMN = doc.getAmountMNCredit() != null ? doc.getAmountMNCredit()
                : BigDecimal.ZERO;
        final BigDecimal amountDebitMN = doc.getAmountMNDebit() != null ? doc.getAmountMNDebit()
                : BigDecimal.ZERO;
        final BigDecimal amountMN = amountCreditMN.add(amountDebitMN);
        final BigDecimal amountCreditME = doc.getAmountMECredit() != null ? doc.getAmountMECredit()
                : BigDecimal.ZERO;
        final BigDecimal amountDebitME = doc.getAmountMEDebit() != null ? doc.getAmountMEDebit()
                : BigDecimal.ZERO;
        final BigDecimal amountME = amountCreditME.add(amountDebitME);
        if (BigDecimal.ZERO.compareTo(amountMN) == 0 && BigDecimal.ZERO.compareTo(amountME) == 0) {
            ImportDetails.LOG.info(
                    "For Document: '{}'. Sum of Credit with Debit Amount (ME): '{}' + '{}' and Credit with Debit Amount (MN): '{}' + '{}' are Zero (0)",
                    doc.getName(), amountCreditME, amountDebitME, amountCreditMN, amountDebitMN);
        } else {
            ImportDetails.LOG.error(
                    "For Document: '{}'. Sum of Credit with Debit Amount (ME): '{}' + '{}' = '{}' and Credit with Debit Amount (MN): '{}' + '{}' = '{}'",
                    doc.getName(), amountCreditME, amountDebitME, amountME, amountCreditMN, amountDebitMN,
                    amountMN);
        }

        final Insert insert = new Insert(CIAccounting.TransactionOpeningBalance);
        insert.add(CIAccounting.TransactionOpeningBalance.Date, _date);
        final StringBuilder descBldr = new StringBuilder()
                .append(doc.getInstance() != null ? doc.getInstance().getType().getLabel() : "Sin Documento")
                .append(": ").append(doc.getName()).append(" - RUC: ").append(doc.getRuc()).append(" - ")
                .append(doc.getDate()).append(" - ").append(doc.getDesc());

        insert.add(CIAccounting.TransactionOpeningBalance.Description, descBldr.toString());
        insert.add(CIAccounting.TransactionOpeningBalance.Status,
                Status.find(CIAccounting.TransactionStatus.Open));
        insert.add(CIAccounting.TransactionOpeningBalance.PeriodLink, periodInst);
        insert.executeWithoutAccessCheck();

        if (_docMap != null) {
            final Instance instance = insert.getInstance();
            new Create().connectDocs2Transaction(_parameter, instance, doc.getInstance());
        }

        final Map<String, Account> accounts = doc.getAccounts();
        final Instance basCur = Currency.getBaseCurrency();
        for (final Account acc : accounts.values()) {
            final Insert insertpos = new Insert(
                    acc.getAmountMN().compareTo(BigDecimal.ZERO) > 0 ? CIAccounting.TransactionPositionCredit
                            : CIAccounting.TransactionPositionDebit);
            insertpos.add(CIAccounting.TransactionPositionAbstract.AccountLink, acc.getInstance());
            insertpos.add(CIAccounting.TransactionPositionAbstract.Amount, acc.getAmountMN());
            insertpos.add(CIAccounting.TransactionPositionAbstract.CurrencyLink, basCur);
            insertpos.add(CIAccounting.TransactionPositionAbstract.Rate, acc.getRateObject());
            insertpos.add(CIAccounting.TransactionPositionAbstract.RateAmount, acc.getAmountME());
            insertpos.add(CIAccounting.TransactionPositionAbstract.RateCurrencyLink, 1);
            insertpos.add(CIAccounting.TransactionPositionAbstract.TransactionLink, insert.getInstance());
            insertpos.executeWithoutAccessCheck();
        }

        if (amountCreditMN.compareTo(amountDebitMN.abs()) != 0
                && amountCreditMN.subtract(amountDebitMN.abs()).abs().compareTo(new BigDecimal("0.05")) <= 0) {
            Insert insertpos = null;
            Account acc = null;
            if (amountCreditMN.compareTo(amountDebitMN.abs()) > 0) {
                acc = getRoundingAccount(AccountingSettings.PERIOD_ROUNDINGDEBIT);
                acc.addAmountMN(amountCreditMN.subtract(amountDebitMN.abs()).negate());
                acc.addAmountME(amountCreditME.subtract(amountDebitME.abs()).negate());
                insertpos = new Insert(CIAccounting.TransactionPositionDebit);
            } else {
                acc = getRoundingAccount(AccountingSettings.PERIOD_ROUNDINGCREDIT);
                acc.addAmountMN(amountDebitMN.abs().subtract(amountCreditMN));
                acc.addAmountME(amountDebitME.abs().subtract(amountCreditME));
                insertpos = new Insert(CIAccounting.TransactionPositionCredit);
            }
            insertpos.add(CIAccounting.TransactionPositionAbstract.AccountLink, acc.getInstance());
            insertpos.add(CIAccounting.TransactionPositionAbstract.Amount, acc.getAmountMN());
            insertpos.add(CIAccounting.TransactionPositionAbstract.CurrencyLink, basCur);
            insertpos.add(CIAccounting.TransactionPositionAbstract.Rate, acc.getRateObject());
            insertpos.add(CIAccounting.TransactionPositionAbstract.RateAmount, acc.getAmountME());
            insertpos.add(CIAccounting.TransactionPositionAbstract.RateCurrencyLink, 1);
            insertpos.add(CIAccounting.TransactionPositionAbstract.TransactionLink, insert.getInstance());
            insertpos.executeWithoutAccessCheck();
        } else if (amountCreditMN.compareTo(amountDebitMN.abs()) != 0
                && amountCreditMN.subtract(amountDebitMN.abs()).abs().compareTo(new BigDecimal("0.05")) > 0) {
            Insert insertpos = null;
            final Account acc = getRoundingAccount(AccountingSettings.PERIOD_TRANSFERACCOUNT);
            ;
            if (amountCreditMN.compareTo(amountDebitMN.abs()) > 0) {
                acc.addAmountMN(amountCreditMN.subtract(amountDebitMN.abs()).negate());
                acc.addAmountME(amountCreditME.subtract(amountDebitME.abs()).negate());
                insertpos = new Insert(CIAccounting.TransactionPositionDebit);
            } else {
                acc.addAmountMN(amountDebitMN.abs().subtract(amountCreditMN));
                acc.addAmountME(amountDebitME.abs().subtract(amountCreditME));
                insertpos = new Insert(CIAccounting.TransactionPositionCredit);
            }
            insertpos.add(CIAccounting.TransactionPositionAbstract.AccountLink, acc.getInstance());
            insertpos.add(CIAccounting.TransactionPositionAbstract.Amount, acc.getAmountMN());
            insertpos.add(CIAccounting.TransactionPositionAbstract.CurrencyLink, basCur);
            insertpos.add(CIAccounting.TransactionPositionAbstract.Rate, acc.getRateObject());
            insertpos.add(CIAccounting.TransactionPositionAbstract.RateAmount, acc.getAmountME());
            insertpos.add(CIAccounting.TransactionPositionAbstract.RateCurrencyLink, 1);
            insertpos.add(CIAccounting.TransactionPositionAbstract.TransactionLink, insert.getInstance());
            insertpos.executeWithoutAccessCheck();
        }
    }

    return ret;
}

From source file:org.eclipse.smarthome.binding.fsinternetradio.test.FSInternetRadioHandlerJavaTest.java

private boolean isConfigurationComplete(Configuration config) {
    String ip = (String) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_IP);
    BigDecimal port = (BigDecimal) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_PORT.toString());
    String pin = (String) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_PIN.toString());

    if (ip == null || port.compareTo(BigDecimal.ZERO) == 0 || StringUtils.isEmpty(pin)) {
        return false;
    }//from w ww  .ja v a 2  s  . com
    return true;
}

From source file:org.egov.collection.service.elasticsearch.CollectionDocumentElasticSearchService.java

public List<TaxPayerDashBoardDetails> returnUlbWiseAggregationResults(
        final CollectionDashBoardRequest collectionDashBoardRequest, final String indexName,
        final Boolean order, final String orderingAggregationName, final int size,
        final List<String> serviceDetails) {
    final List<TaxPayerDashBoardDetails> taxPayers = new ArrayList<>();
    BoolQueryBuilder boolQuery = prepareWhereClause(collectionDashBoardRequest);
    if (!serviceDetails.isEmpty())
        boolQuery = boolQuery.filter(QueryBuilders.termsQuery(BILLING_SERVICE, serviceDetails));
    String groupingField;/*from   w w w  . j a va 2  s .co  m*/
    if (StringUtils.isNotBlank(collectionDashBoardRequest.getUlbCode())
            || StringUtils.isNotBlank(collectionDashBoardRequest.getType())
                    && collectionDashBoardRequest.getType().equals(DASHBOARD_GROUPING_WARDWISE))
        groupingField = REVENUE_WARD;
    else
        groupingField = CITY_NAME;

    Long startTime = System.currentTimeMillis();
    AggregationBuilder aggregation;
    SearchQuery searchQueryColl;
    aggregation = AggregationBuilders.terms(BY_AGGREGATION_FIELD).field(groupingField).size(size)
            .order(Terms.Order.aggregation(orderingAggregationName, order))
            .subAggregation(AggregationBuilders.sum(TOTAL_COLLECTION).field(TOTAL_AMOUNT));
    searchQueryColl = new NativeSearchQueryBuilder().withIndices(indexName).withQuery(boolQuery)
            .addAggregation(aggregation).build();
    final Aggregations collAggr = elasticsearchTemplate.query(searchQueryColl,
            response -> response.getAggregations());

    Long timeTaken = System.currentTimeMillis() - startTime;
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("Time taken by ulbWiseAggregations is : " + timeTaken + MILLISECS);

    TaxPayerDashBoardDetails taxDetail;
    boolean isWard = false;
    startTime = System.currentTimeMillis();
    final Date fromDate = new DateTime().withMonthOfYear(4).dayOfMonth().withMinimumValue().toDate();
    final Date toDate = org.apache.commons.lang3.time.DateUtils.addDays(new Date(), 1);
    final Date lastYearFromDate = org.apache.commons.lang3.time.DateUtils.addYears(fromDate, -1);
    final Date lastYearToDate = org.apache.commons.lang3.time.DateUtils.addYears(toDate, -1);
    final StringTerms totalAmountAggr = collAggr.get(BY_AGGREGATION_FIELD);
    for (final Terms.Bucket entry : totalAmountAggr.getBuckets()) {
        taxDetail = new TaxPayerDashBoardDetails();
        taxDetail.setRegionName(collectionDashBoardRequest.getRegionName());
        taxDetail.setDistrictName(collectionDashBoardRequest.getDistrictName());
        taxDetail.setUlbGrade(collectionDashBoardRequest.getUlbGrade());
        final String fieldName = String.valueOf(entry.getKey());
        if (groupingField.equals(REVENUE_WARD)) {
            taxDetail.setWardName(fieldName);
            isWard = true;
        } else
            taxDetail.setUlbName(fieldName);
        final Sum totalCollectionAggregation = entry.getAggregations().get(TOTAL_COLLECTION);
        final BigDecimal totalCollections = BigDecimal.valueOf(totalCollectionAggregation.getValue())
                .setScale(0, BigDecimal.ROUND_HALF_UP);
        taxDetail.setCytdColl(totalCollections);
        final BigDecimal lastYearCollection = getCollectionBetweenDates(collectionDashBoardRequest,
                lastYearFromDate, lastYearToDate, fieldName, serviceDetails, isWard);
        taxDetail.setLytdColl(lastYearCollection);
        BigDecimal variation;
        if (lastYearCollection.compareTo(BigDecimal.ZERO) == 0)
            variation = CollectionConstants.BIGDECIMAL_100;
        else
            variation = totalCollections.subtract(lastYearCollection)
                    .multiply(CollectionConstants.BIGDECIMAL_100)
                    .divide(lastYearCollection, 1, BigDecimal.ROUND_HALF_UP);
        taxDetail.setLyVar(variation);
        taxPayers.add(taxDetail);
    }
    timeTaken = System.currentTimeMillis() - startTime;
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("Time taken for setting values in returnUlbWiseAggregationResults() is : " + timeTaken
                + MILLISECS);
    return returnTopResults(taxPayers, size, order);
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>&lt;gt;</code> operator applied to BigDecimal values. */
public static boolean ne(BigDecimal b0, BigDecimal b1) {
    return b0.compareTo(b1) != 0;
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>&lt;</code> operator applied to BigDecimal values. */
public static boolean lt(BigDecimal b0, BigDecimal b1) {
    return b0.compareTo(b1) < 0;
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>&le;</code> operator applied to BigDecimal values. */
public static boolean le(BigDecimal b0, BigDecimal b1) {
    return b0.compareTo(b1) <= 0;
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>&gt;</code> operator applied to BigDecimal values. */
public static boolean gt(BigDecimal b0, BigDecimal b1) {
    return b0.compareTo(b1) > 0;
}