title: How to obtain the precision of BigInteger in Java
body: <p>I'm implementing a custom validator in my web application that can validate a <code>BigInteger</code> property of a bean. This property is mapped to a <code>Number(8, 0)</code> type of Oracle table.</p>
  
  <p>Like <code>BigDecimal</code>, I don't see a method for <code>BigInteger</code> that can return the precision of a given number.</p>
  
  <p>Basically, I'm first converting a <code>BigInteger</code> value to <code>BigDecimal</code> to obtain its precision like the following (It is just for a demonstration).</p>
  
  <pre><code>int minPrecision=1;
  int maxPrecision=8;
  
  BigInteger bigInteger=new BigInteger("12345");
  BigDecimal bigDecimal=new BigDecimal(bigInteger, 0);
  
  int precision=bigDecimal.precision();
  boolean isValid=precision&gt;=minPrecision &amp;&amp; precision&lt;=maxPrecision;
  
  System.out.println(isValid+" : "+precision);
  </code></pre>
  
  <p>Does <code>BigInteger</code> provide a precise way to return the precision of its value?</p>