title: What variable type can I use to hold huge numbers (30+ digits) in java?
body: <p>Is there a really large variable type I can use in Java to store huge numbers (up to around forty digits)?</p>
  
  <p><code>long</code>'s maximum value is 9223372036854775807, which is 19 digits -- not nearly large enough. </p>
  
  <p>I'm trying to create a calculator that can handle large numbers, because most nowadays can only hold an insufficient 10 digits or so, and I want want accurate calculations with numbers of a much larger magnitude</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks for the answers. I can use <code>BigInteger</code> for big integers, the only limit being the computer's memory (should be sufficient). For decimals, I'll use <code>float</code> ^e, as @WebDaldo suggested, or <code>BigDecimal</code> (similar to BigInteger), as @kocko suggested.</p>