Check if a number is Even - Android java.lang

Android examples for java.lang:Math

Description

Check if a number is Even

Demo Code


//package com.java2s;

public class Main {
    /**//from w w  w  . j av a  2 s .c  o m
     * Check if a number is Even
     * 
     * @param num
     *            int number
     * @return true if the num is even and false if it's odd
     */
    public static boolean isEven(int num) {
        return (num % 2 == 0);
    }
}

Related Tutorials