KodeGym/Blog Jawa/Acak/Metode Java Math.ceil().
John Squirrels
tingkat
San Francisco

# Metode Java Math.ceil().

Iku apik kanggo familiarize dhewe karo fungsi ceil ing matematika sadurunge pindhah menyang metode ceil ing Jawa.

## Apa fungsi langit-langit ing matematika?

"Fungsi langit-langit ngowahi angka desimal menyang integer paling gedhe langsung."
Yen nomer liwati wis nomer wutuh utawa integer, banjur nomer padha nilai langit-langit. Nanging, yen sampeyan ngliwati nilai null menyang fungsi ceil ing matematika, sampeyan bakal entuk "nol".

## Apa metode Math.ceil () ing Jawa?

Jawa nyedhiyakake cara sing dibangun kanggo ngetung fungsi ceil ing matematika. Sing bisa digunakake kanthi bebas kanthi menehi argumen jinis "pindho" menyang metode Math.ceil () . Ayo goleki sawetara kasus wates sadurunge pindhah menyang kasus panggunaan.
• Yen parameter " dobel " uga matematika " integer " [contone: 2.0 padha karo 2 ] - Asil padha karo integer [IE; 2 dhewe] .
• Yen parameter (parameter ayo = x) kurang saka 0 nanging luwih gedhe tinimbang -1 [-1 > x <0] - Asil padha karo nol negatif [-0] .
• Yen parameter NaN, +0, -0 utawa ∞ - Asil padha karo parameter .
• Yen parameter " null " - ora kaya fungsi ceil matematika ngendi sampeyan njaluk nul, kene sampeyan bakal njaluk java.lang.NullPointerException a .

``````class Main {

public static void main(String[] args) {

Double totalStudentsInClass = 25.0;
Double flourWeightInKgs = 5.13;
Double aPoundOfOxygenInLitres = 0.3977;
Double startingArrayIndexInJava = 0.0;
Double aSelfDrivingCar = Double.NaN;
Double numberOfStarsInTheSky = Double.POSITIVE_INFINITY;
// For parameter  [ -1 > x < 0 ]
Double x = -0.025;

// using Math.ceil() method
System.out.println("Total Students In Class = " + Math.ceil(totalStudentsInClass));
System.out.println("Flour Weight In Kgs = " + Math.ceil(flourWeightInKgs));
System.out.println("A Pound of Oxygen in Litres = " + Math.ceil(aPoundOfOxygenInLitres));
System.out.println("Starting Array Index In Java = " + Math.ceil(startingArrayIndexInJava));
System.out.println("A Self Driving Car = " + Math.ceil(aSelfDrivingCar));
System.out.println("Number Of Stars In The Sky = " + Math.ceil(numberOfStarsInTheSky));
System.out.println("Positive Zero = " + Math.ceil(+0.0));
System.out.println("Negative Zero = " + Math.ceil(-0.0));
System.out.println("x = " + x + " [ -1 > x < 0 ] = " + Math.ceil(-0.0));
}

}``````

### Output

Total Siswa Ing Kelas = 25,0 Bobot Tepung Ing Kg = 6,0 Pound Oksigen ing Liter = 1,0 Indeks Array Awal Ing Jawa = 0,0 Mobil Nyopir Mandiri = NaN Jumlah Lintang Ing Langit = Tanpa wates Positif Zero = 0,0 Negatif Zero = -0,0 x = -0,025 [ -1 > x < 0 ] = -0,0

## Kesimpulan

Kanggo duwe genggeman swara liwat cara java ceil, disaranake sampeyan uga duwe sawetara kawruh latar mburi apik saka fungsi langit-langit matematika. Nduwe dhasar sing kuwat mbantu mbangun basis sing kuat. Nanging, sampeyan bisa terus sinau, tuwuh lan aja lali latihan!

Wacan liyane:

Komentar
Sampeyan kudu mlebu kanggo ninggalake komentar
Kaca iki durung duwe komentar