Small question!
Hi,
Why should I add casting for :
float[] array ={(float) 12.34, (float) 24.78, (float) 14.67};
I want a method to do this:
12.346 --> 12.34
Please, with example
Hi,
Why should I add casting for :
float[] array ={(float) 12.34, (float) 24.78, (float) 14.67};
I want a method to do this:
12.346 --> 12.34
Please, with example
> Hi,
>
> Why should I add casting for :
>
> float[] array = {(float) 12.34, (float) 24.78,
> (float) 14.67};
>
> I want a method to do this:
>
> 12.346 --> 12.34
>
> Please, with example
Because 12.34 is a double.
12.34f is a float
> 12.346 --> 12.34
Check out DecimalFormat
http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html