public class Main { public static void main(String[] args) { int[] a = {5,4,20}; System.out.println(isAndEquation(a)); } public static boolean isAndEquation(int[] a) { int result = a[0]; for (int i = 1; i < a.length; i++) { result = result & a[i]; } for (int i = 0; i < a.length; i++) { if (result == a[i]) return true; } return false; } }