Converted the texture extraction code to JAVA from George's C version (still not working)