I am currently working on a program that involves huge calculations like (345324523452345245345*4543563456456545456) .
Should BigDecimal suffice for this ? Also i sometimes need to convert them into double for example Math.pow(BigDecimalObject.doubleValue(),2)
Will there be a huge probability of an error during such conversions ?
You shouldn't mix floating point and arbitrary precision numbers.
If all your calculations are within integer arithmetic, you could use BigInteger. If not, BigDecimal is the way to go if you want arbitrary precision. If you only ever take integer powers of your number, you can use BigInteger.pow() or BigDecimal.pow().
Never use a power method for squares. You can lose on performance, and possibly precision, because there is a much simpler way to calculate squares.Use Strings rather than doubles as arguments to the BigDecimal constructor.