Skip to content

Instantly share code, notes, and snippets.

@vortekc
Created March 5, 2015 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vortekc/977d1c140afedf029f74 to your computer and use it in GitHub Desktop.
Save vortekc/977d1c140afedf029f74 to your computer and use it in GitHub Desktop.
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