High precision calculations with mutable class in Java
<p>I'm designing a tool using Java 6, that will read data from Medical Devices. </p>

<p>Each Medical Device manufacturer implements its own Firmware/Protocol.  Vendors (like me) write their own interface that 
uses the manufacturer's firmware commands to acquire data from the Medical Device.  Most firmwares will output data in a cryptic fashion, so the vendor receiving it, is supposed to scale it by doing some calculations on it, in order to figureout the true value. </p>

<p>Its safe to assume that medical data precision is as important as financial data precision etc. </p>

<p>I've come to the conclusion of using BigDecimal to do all numerical calculations and store the final value.  I'll be receiving a new set of data almost every second, which means, I'll be doing calculations and updating the same set of values every second.  Example:Data coming across from a ventilator for each breath.</p>

<p>Since BigDecimal is immutable, I'm worried about the number of objects generated in the heap every second. Especially since the tool will have to scale up to read data from lets say 50 devices at the same time.</p>

<p>I can increase the heap size and all that, but still here's my questions....</p>

<p>Questions</p>

<ol>
<li><p>Is there any mutable cousin of BigDecimal I could use?</p></li>
<li><p>Is there any existing opensource framework to do something like this?</p></li>
<li><p>Is Java the right language for this kind of functionality?</p></li>
<li><p>Should I look into Apfloat? But Apfloat is immutable too.  How about JScience?</p></li>
<li><p>Any Math library for Java I can use for high precision </p></li>
<li><p>I'm aiming for a precision of upto 10 digits only.  Dont need more than that.  So whats the best library or course of action for this type of precision?</p></li>
</ol>

<p>Thanks
Amit</p>
