Contents

About comparing the lengths of arrays (with.Java)

   Aug 15, 2023     0 min read

In this article, we learned about comparing the lengths of arrays (with.Java)

I’m preparing for a coding test and learning about grammar and organization.

There are many ways to compare the lengths of arrays. I’m going to utilize one of them, Math.

Math is a library function in Java, and the functions I will introduce to compare the length of an array are min and max.

What is Math.min()?

It is a function that returns the smaller of two given numbers. For example, if you call Math.min(a, b), it will return the smaller of a and b.

What is Math.max()?

A function that returns the larger of two given numbers. This function works in reverse to Math.min().

For example, calling Math.max(a, b) returns the larger of a and b.