// finding the smaller of two ints int smaller = Math.min( a, b ); // also works with long, float and double e.g. double smallerDouble = Math.min( aDouble, bDouble );