I am trying to get rid of the .0 left behind a float number when I add whole numbers together. ex. if i do 10+10 it will print out 20.0 but i want it to print out 20 unless there is a decimal in the number. P.S ive been looking all over on this site and cant find the anser to my question so why did someone make this a duplicate makes no sense.
float numOne = Float.parseFloat(numberOne.getText());
float numTwo = Float.parseFloat(numberTwo.getText());
float anser = numOne+numTwo;
String AR = String.valueOf(anser);
anserLabel.setText(AR);