User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:lang:math:round

This is an old revision of the document!


round

rounds a number

example of java.lang.Math.round

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package roundanumber;
import java.lang.Math;
/**
 *
 * @author dgohlke
 */
public class Roundanumber {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
 
        double number, number2;
        number = 33.384422;
        number2 = 33.898823;
 
    System.out.println("number: " + Math.round(number));
    System.out.println("number2: " + Math.round(number2));
    }
}

output of Roundanumber

  number: 33
  number2: 34

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
java/lang/math/round.1365405902.txt · Last modified: 2024/02/16 01:11 (external edit)

Impressum Datenschutz