code: public BigInteger calculateBalanceForAddress(Address address) throws BlockStoreException {
          maybeConnect();
          PreparedStatement s = null;
          try {
              s = conn.get().prepareStatement(getBalanceSelectSQL());
              s.setString(1, address.toString());
              ResultSet rs = s.executeQuery();
              BigInteger balance = BigInteger.ZERO;
              if (rs.next()) {
                  return BigInteger.valueOf(rs.getLong(1));
              }
              return balance;
          } catch (SQLException ex) {
              throw new BlockStoreException(ex);
          } finally {
              if (s != null) {
                  try {
                      s.close();
                  } catch (SQLException e) {
                      throw new BlockStoreException("Could not close statement");
                  }
              }
          }
      }
docs: Calculate the balance for a coinbase, to-address, or p2sh address.
  
  <p>The balance {@link DatabaseFullPrunedBlockStore#getBalanceSelectSQL()} returns
  the balance (summed) as an number, then use calculateClientSide=false</p>
  
  <p>The balance {@link DatabaseFullPrunedBlockStore#getBalanceSelectSQL()} returns
  the all the openoutputs as stored in the DB (binary), then use calculateClientSide=true</p>
  
  @param address The address to calculate the balance of
  @return The balance of the address supplied.  If the address has not been seen, or there are no outputs open for this
  address, the return value is 0.
  @throws BlockStoreException If there is an error getting the balance.