title: How do I decode a string from base 32 to a BigInteger
body: <p>I tried the following code:</p>
  
  <pre><code>import java.math.BigInteger;
  import org.apache.commons.codec.binary.Base32;
  import org.junit.Test;
  
  public class Sandbox
  {
    @Test
    public void testSomething() {
      String sInput = "GIYTINZUHAZTMNBX";
  
      BigInteger bb = new BigInteger(new Base32().decode(sInput));
  
      System.out.println("number = " + bb);
    }
  }
  </code></pre>
  
  <p>and heres the output:</p>
  
  <pre><code>number = 237025977136523702055991
  </code></pre>
  
  <p>using <a href="http://online-calculators.appspot.com/base32/" rel="nofollow">this website to convert between base 32</a> I get a different result than the actual output. Heres the result I expect to see based on what I got from the website:</p>
  
  <pre><code>expected output = 2147483647
  </code></pre>
  
  <p>Any idea why this is happening?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Forgive me for making it confusing by purposefully attempting to convert 2^31-1.</p>
  
  <p>Using the conversion website I linked to earlier, I changed the input:</p>
  
  <pre><code>String sInput = "GE4DE===";
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>number = 182
  </code></pre>
  
  <p>Actual output:</p>
  
  <pre><code>number = 3225650
  </code></pre>