I have a double such as 32.559.
How would I get rid of all but one decimal digit so my output would look like 32.5?
I have a double such as 32.559.
How would I get rid of all but one decimal digit so my output would look like 32.5?
 
    
     
    
    I'm assuming you just want to print it that way:
String result = String.format("%.1f", value);
 
    
    You can use DecimalFormat:   
Locale locale  = new Locale("en", "UK");
String pattern = "###.#";
DecimalFormat decimalFormat = (DecimalFormat)
NumberFormat.getNumberInstance(locale);
decimalFormat.applyPattern(pattern);
String format = decimalFormat.format(32.559);
System.out.println(format);
The output printed from this code would be:
32.5
This is the Basic above, you can go throws here for more details.
 
    
    