int - Java Float to "remove" comma -
I need to change the float to an int, such as the comma was removed. Example: 23.2343f - & gt; 232343
Private Static Ent Kotka {For (Int i = 0 ;; I ++) {if ((* value (float) Math.pow (10, i) )% 1.0 f == 0.0f) Return (value) (value * MathPo (10, i)); }} The problem is with the integer number, for example if I pass 23000.235 9 F then it becomes 23000236, because it makes the input to 23000.236 goals.
is not so accurate in the Java float, that you
float f = 23000.2359f; Println (f); outputs
23000.236 To get the output you want, you can double You can use like double D = 23000.2359; String v = String.valueOf (d) .replace (".", ""); Int val = integer. ParisInt (V); Println (val); Output is (requested)
230002359
Comments
Post a Comment