bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java Math floorDiv() Method

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java Math floorDiv() Method?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___.out.println(Math.floorDiv(10, 5));
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The floorDiv() method returns the division between two integers rounded down.
Definition and Usage
Java Math floorDiv() Method

❮ Math Methods

Example

System.out.println(Math.floorDiv(10, 5));
System.out.println(Math.floorDiv(10, 4));
System.out.println(Math.floorDiv(-10, 4));
System.out.println(Math.floorDiv(-10, 5));

Definition and Usage

The floorDiv() method returns the division between two integers rounded down. This is different from an ordinary integer division in that negative results are rounded down away from zero instead of truncated towards it.

One of the following

public static int floorDiv(int
dividend , int
divisor )
public static long floorDiv(long
dividend , long
divisor )

Parameter Values

ParameterDescription
dividendRequired. The dividend of the division.
divisorRequired. The divisor of the division.

Technical Details

Returns:An int or long value representing a division between two integers.
Throws:ArithmeticException - If the divisor is zero.
Java version:1.8+

Previous

Java Math floor() Method

Next

Java Math floorMod() Method