How I can to limit decimal numbers of double variable. Indeed I want to change the numbers example 2.34567890 to 2.34 by lower decimal numbers? How to do it? Please help me. Thanks a lot.
            Asked
            
        
        
            Active
            
        
            Viewed 128 times
        
    0
            
            
        - 
                    5Possible duplicate of [How to round a number to n decimal places in Java](http://stackoverflow.com/questions/153724/how-to-round-a-number-to-n-decimal-places-in-java) – Bertrand Martel Jul 19 '16 at 01:38
1 Answers
0
            
            
        Try
double d = 2.34567890;
DecimalFormat newFormat = new DecimalFormat("#.##");
double twoDecimal =  Double.valueOf(newFormat.format(d)); // output 2.35
 
    
    
        Linh
        
- 57,942
- 23
- 262
- 279
