java check if a number is even or odd using bitwise operator

ht‮www//:spt‬.lautturi.com
java check if a number is even or odd using bitwise operator
/**
 * @author lautturi.com
 * Java example: check even or odd in java
 */

import java.util.*;

public class Lautturi {

	public static void main(String[] args) {

		int num = 12;
		if((num&1)==0)
			  System.out.println("It is even");
			else
			  System.out.println("It is odd");

	}
}
Created Time:2017-09-10 09:24:06  Author:lautturi