Java Bit Manipulation Python Code For Snake