Example usage for java.math BigInteger longValue

List of usage examples for java.math BigInteger longValue

Introduction

In this page you can find the example usage for java.math BigInteger longValue.

Prototype

public long longValue() 

Source Link

Document

Converts this BigInteger to a long .

Usage

From source file:com.aegiswallet.utils.WalletUtils.java

public static String getWalletCurrencyValue(Context context, SharedPreferences prefs, BigInteger balance) {
    String result = "";

    File file = context.getApplicationContext().getFileStreamPath(Constants.BLOCKCHAIN_CURRENCY_FILE_NAME);
    if (file.exists()) {
        JSONObject jsonObject = BasicUtils.parseJSONData(context, Constants.BLOCKCHAIN_CURRENCY_FILE_NAME);
        try {/*from w w w.  jav a  2  s  .  c om*/

            String balanceInBTC = balance.toString();

            if (balance.longValue() > 0)
                balanceInBTC = BasicUtils.formatValue(balance, Constants.BTC_MAX_PRECISION, 0);
            BigDecimal formattedBalance = new BigDecimal(balanceInBTC);

            if (jsonObject != null) {

                JSONObject newObject = jsonObject
                        .getJSONObject(prefs.getString(Constants.CURRENCY_PREF_KEY, null));
                Double doubleVal = newObject.getDouble("last");
                BigDecimal decimal = BigDecimal.valueOf(doubleVal);

                result = newObject.getString("symbol")
                        + decimal.multiply(formattedBalance).setScale(2, RoundingMode.HALF_EVEN).toString();
            }
        } catch (JSONException e) {
            Log.e("Wallet Utils", "JSON Exception " + e.getMessage());
        }
    }

    return result;
}

From source file:cn.dsgrp.field.stock.service.account.AccountService.java

/**
 * ??.
 */
private boolean isSupervisor(BigInteger id) {
    return id.longValue() == 1;
}

From source file:cn.dsgrp.field.stock.web.account.ProfileController.java

/**
 * RequestMapping?Model, Struts2 Preparable,?formid?User,?Form??
 * update()formidupdate./*from www.j  a  v  a 2s  .  c  om*/
 */
@ModelAttribute
public void getUser(@RequestParam(value = "id", defaultValue = "-1") BigInteger id, Model model) {
    if (id.longValue() != -1) {
        model.addAttribute("user", accountService.getUser(id));
    }
}

From source file:dao.CategoryDao.java

public List<Long> getRequiredParamsIds(Long catId) {
    String sql = "select p.parametr_id from param_category_link l left join parametr p on l.parametr_id=p.parametr_id where l.category_id=:catId and l.req_type=:req";
    Query query = getCurrentSession().createSQLQuery(sql);
    query.setParameter("catId", catId);
    query.setParameter("req", ParamCategoryLink.REQUIRED);
    //query.setParameter("bool", Parametr.BOOL);
    List<BigInteger> rawRes = query.list();
    ArrayList<Long> res = new ArrayList();
    for (BigInteger id : rawRes) {
        res.add(id.longValue());
    }//www . j  a v  a2 s  .c om
    return res;
}

From source file:br.com.hslife.orcamento.repository.AuditoriaRepository.java

public long countRegistroAuditoriaByUsuario(String usuario) {
    String sql = "select count(*) from orcamento.auditoria where usuario = '" + usuario + "'";
    Query query = getSession().createSQLQuery(sql);
    BigInteger queryResult = (BigInteger) query.uniqueResult();
    return queryResult.longValue();
}

From source file:org.openhie.openempi.model.MatchPairStatHalf.java

public void setPerson_pseudo_id(java.math.BigInteger personPseudoId) {
    setPersonPseudoId(personPseudoId.longValue());
}

From source file:br.com.hslife.orcamento.repository.CategoriaDocumentoRepository.java

public boolean existsLinkages(CategoriaDocumento categoriaDocumento) {
    boolean result = true;

    String sql = "select count(id) from documento where idCategoriaDocumento = " + categoriaDocumento.getId();

    Query query = getSession().createSQLQuery(sql);

    BigInteger queryResult = (BigInteger) query.uniqueResult();

    if (queryResult.longValue() == 0) {
        return false;
    }/*from  ww  w  .jav  a 2  s  . c  o  m*/

    return result;
}

From source file:org.openhie.openempi.model.MatchPairStatHalf.java

public void setMatch_pair_stat_half_id(java.math.BigInteger matchPairStatHalfId) {
    setMatchPairStatHalfId(matchPairStatHalfId.longValue());
}

From source file:org.openhie.openempi.model.MatchPairStat.java

public void setMatch_pair_stat_id(java.math.BigInteger matchPairStatId) {
    setMatchPairStatId(matchPairStatId.longValue());
}

From source file:net.ripe.ipresource.Asn.java

public Asn(BigInteger value) {
    this(value.longValue());
}