-
-
Save vortekc/977d1c140afedf029f74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
int RPK = 32; //100000 | |
int ROS82x2 = 2; //000010 | |
int ROS82x6 = 4; //000100 | |
int FAB50x2 = 8; //001000 | |
int DEFAULT_EMPTY = 1; //00000001 | |
//Устанавливаем на самолет рпк и 50-ки. В редакторе это 101001 (41) | |
int planeStatus = DEFAULT_EMPTY | FAB50x2; | |
planeStatus |= RPK; | |
//сейчас planeStatus = 41 (101001) | |
System.out.print("planeStatus: " + planeStatus); | |
//проверяем а стоит ли рпк | |
if((planeStatus & RPK) != 0) { | |
System.out.print("We got RPK"); | |
} | |
//проверяем а стоит ли ФАБ | |
if ((planeStatus & FAB50x2) != 0) { | |
System.out.println("We got FAB50x2"); | |
} | |
//проверяем а стоит ли ракета | |
if ((planeStatus & ROS82x2) != 0) { | |
System.out.println("We got ROS82x2"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment