Hello everyone. Please tell me how working function
number = scanner.nextInt(); if ((number & 0) == 1)`
Full code
package com.company; import java.util.Scanner; public class CheckParity { public static void main(String[] args) { int number; Scanner scanner = new Scanner(System.in); System.out.println("Enter number: "); number = scanner.nextInt(); if ((number & 0) == 1) { System.out.println("Even number"); } else { System.out.println("The number is not even"); } } }
--- Update ---
The most of I can't understand if ((number & 0) == 1)
Why we using number and &?
& its and. So why we do that?
Why we comparing number and 0? And why after priority () we use == 1?