Type casting a Number to double Type casting a Number to double android android

Type casting a Number to double


Use Number.doubleValue():

y2 = molWt[x].doubleValue();

instead of trying to cast. Number cannot be cast to a primitive double.


you can use java.lang.Number.doubleValue() method to cast a number to a double object.

y2= molWt[x].doubleValue()