2048 Java Algorithm