Hi,
I'm reading a STL binary file using the following code:
public void LoadSTLBinary(DataInputStream datainputstream) throws Exception {
datainputstream.read(new byte[80]);
int iTriaCount = readInt(datainputstream);
System.out.println("Tiangles_bitwise : " + iTriaCount);
triangles = new Triangle[iTriaCount];
......
......
datainputstream.close();
}
//Needed since binary file is in little endian format
public int readInt(DataInputStream datainputstream) throws IOException {
int i = datainputstream.readInt();
return ((i & 0xff) << 24) + ((i & 0xff00) << 8) + ((i & 0xff0000) >> 8) + (i >> 24 & 0xff);
}
Note: unable to attach Sample STL binary file. please go through
http://en.wikipedia.org/wiki/STL_(file_format)#Binary_STL
When i run the code as a
java application, the
system.out.println outputs - "Tiangles_bitwise : 4"
but when called in a
applet , the
system.out.println outputs - "Tiangles_bitwise : 1146060800"
Any help highly appreciated.
Regards,
Rajan_M