Find Odd or Even Number using Modulo, Division and Bitwise & Operator



          Java Program to find out given no is odd or not using Modulo, Division and Bitwise & operator.


package javaFixer;

public class JavaFixerMain {
 public static void main(String[] args) {
  int num = 4;

  // Using Modulo
  if (num % 2 == 0)
   System.out.println("Even");
  else
   System.out.println("odd");

  // Using Division
  if ((num / 2) * 2 == num)
   System.out.println("Even");
  else
   System.out.println("odd");

  // Using Bitwise &
  if ((num & 1) == 0)
   System.out.println("Even");
  else
   System.out.println("odd");

 }
}