Java implementation to generate an Ulam Spiral