This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I ran into an accuracy problem using 'float' so I've switched to BigDecimal. I now have: BigDecimal value1 = new BigDecimal(0); BigDecimal value2 = new BigDecimal(0); String strValue = new String("12345.67"); Question: How do I get the contents of strValue into value1? I've several configurations including: value1 = BigDecimal(strValue); value1 = BigDecimal.valueOf(BigDecimal(strValue)); Regards Vernon Gibson
You could just create it that way String strValue = "12345.67"; BigDecimal value1 = new BigDecimal(strValue); or if you want to continue with the code you have. add it to it. value1 = value1.add(new BigDecimal(strValue)); Hope this helps