VOOZH about

URL: https://www.geeksforgeeks.org/java/java-guava-meanlong-x-long-y-of-longmath-class-with-examples/

⇱ Java Guava | mean(long x, long y) of LongMath Class with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java Guava | mean(long x, long y) of LongMath Class with Examples

Last Updated : 11 Jul, 2025
The mean(long x, long y) method of Guava's LongMath Class accepts two parameters x and y and calculates arithmetic mean of them rounded towards negative infinity. This method is overflow resilient. Syntax:
public static long mean(long x, long y)
Parameters: This method accepts two parameters x and y which are of long type. Return Value: The method returns arithmetic mean of x and y, rounded towards negative infinity. Exceptions: The method doesn’t have any exception. Example 1:
Output:
Mean of 1542 and 421 is : 981
Example 2:
Comment