user50092: I get the value of money in Satoshi and I would like to have it in BTC. I develop the app in Java/Maven/JSP and use BitcoinJ for the framework. I use the code, 
    public Coin getBalance() {

        int fac = (int) Math.pow(10, 8);
        return balance.div(fac);
    }

In the JSP, I use,
<%
    DecimalFormat decimalFormat = new DecimalFormat("#0.00");
%>
<div class="fild_value">
                    <%= decimalFormat.format(model.getBalance().getValue()) %>&nbsp; BTC
</div>

In this way, I miss the value after the decimal. For example, I get 1.00 BTC when I suppose to get 1.68 BTC. How to convert Satoshi to BTC in Java properly?

user423: The Coin.valueOf(long) static constructor takes Satoshis as an input. You can use one of the toString/toFriendlyString/toPlainString methods to derive a human readable value string.

50092: <p>I get the value of money in Satoshi and I would like to have it in BTC. I develop the app in <code>Java/Maven/JSP</code> and use BitcoinJ for the framework. I use the code, </p>

<pre><code>    public Coin getBalance() {

        int fac = (int) Math.pow(10, 8);
        return balance.div(fac);
    }
</code></pre>

<p>In the JSP, I use,</p>

<pre><code>&lt;%
    DecimalFormat decimalFormat = new DecimalFormat("#0.00");
%&gt;
&lt;div class="fild_value"&gt;
                    &lt;%= decimalFormat.format(model.getBalance().getValue()) %&gt;&amp;nbsp; BTC
&lt;/div&gt;
</code></pre>

<p>In this way, I miss the value after the decimal. For example, I get <code>1.00 BTC</code> when I suppose to get <code>1.68 BTC</code>. How to convert Satoshi to BTC in Java properly?</p>
 423: <p>The Coin.valueOf(long) static constructor takes Satoshis as an input. You can use one of the toString/toFriendlyString/toPlainString methods to derive a human readable value string.</p>
