We have been doing a bit of Web Services integration between Domino and .Net. In our situation, the .Net application was interested in receiving numbers as BigDecimal objects. To this end I did a bit of investigation and found that this is the best way to convert from Double (my preferred format) in Java:
import java.math.BigDecimal;
/**
* A set of useful static methods to do with numbers
*/
public class Numbers
{
/**
* Converts a Double to BigDecimal in the most efficient and accurate manner
* BigDecimal is the preferred format for .Net
* @param number
* @return
*/
public static BigDecimal getBigDecimalFromDouble(Double number)
{
String strNumber = number.toString();
BigDecimal bdReturn = new BigDecimal(strNumber);
return bdReturn;
}
}
>>String strNumber = number.toString();
>> Cant do doubleValue.toString()
For Ref: http://www.11tmr.com/11tmr.nsf/emoticons/DLYH-5N3GHL/$FILE/sad.gif“>
C:\TestBigDecimal.java:30: double cannot be dereferenced
String strNumber = amt1.toString();
^
1 error
I think you’re probably using a native double as opposed to a Double object, you’ll just need to convert from one to the other to get this code to work.
Matt