String x = "39.33";
String result ;
Double x1 = new Double(x);
System.err.println("value :"+ x1);
String[] parts = x1.toString().split("\\.");
if(parts != null )
{
if((Integer.parseInt(parts[1])) > 0)
{
result =x1;
}
else
{
result= parts[0];
}
}
please let me know the best way to format/split the value:
my need is….
if x is 39
so x1 is 39.0
so i need result =39
if x is 39.33
so x1 is 39.33
so i need result =39.33
i dont want to use split or condition checking if((Integer.parseInt(parts[1])) > 0).. please let me know the best way for this?
Try this: