I can explain this with an example.
Consider the floating point values like 2.0, 3.0 e.t.c the output must the number i.e 2, 3 e.t.c
If the floating point values are like 2.1, 3.5 e.t.c the output remain the same i.e 2.1, 3.5
Is there any Math operation on floating point values to do this?
LordAnomander :
You can easily check if a float has decimal places.\n\nif (number % (int) number == 0)\n System.out.println((int) number); // you know it has no decimal places\nelse\n System.out.println(number); // it has decimal places and you want to print them\n\n\nThe link provided by Seffy Golan suggests an even better solution, by simply comparing\n\nif (number == (long) number) { ... }\n\n\nI thought I'd take it into my answer as it is a nice approach I wasn't aware of.",
2016-01-13T11:29:39