Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args)
- {
- char states = 0x00000;
- final char running = 0x00002;
- final char jumping = 0x00004; // Don't have to use hex values, although I prefer to
- states |= running;
- if((states & running) == running)
- System.out.println((states & running) + " true");
- states |= jumping;
- if((states & (running | jumping)) == (running | jumping))
- System.out.println((states & (running | jumping)) + " true");
- states &= ~running;
- if((states & running) == running)
- System.out.println((states & running) + "true"); // Wont' happen
- else
- System.out.println((states & running) + " false");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement