tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Google Guava > Primitives > Integers Min and Max

Integers Min and Max 

Google Guava is a java library with lot of utilities and reusable components. This requires the library guava-10.0.jar to be in classpath. The following example shows using Ints.min() and Ints.max() API.

File Name  :  
com/bethecoder/tutorials/guava/primitive_tests/IntMinMaxTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.guava.primitive_tests;

import com.google.common.primitives.Ints;


public class IntMinMaxTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    int [] values = 121729682497291000 };
    System.out.println("Max value in the array : " + Ints.max(values));
    System.out.println("Min value in the array : " + Ints.min(values));
  }
}
   

It gives the following output,
Max value in the array : 1729
Min value in the array : 6



 
  


  
bl  br