In a Little Endian architecture, the integer value 0x1 will be written out in memory like
0x1 0x0 0x0 ....
so that function will return 1
Conversely, in a Big Endian architecture, the order of bytes will be
0x0 0x0 ... 0x1
however many bytes are in an int (greater or equal to 2 for it to work), and so
this function will return 0.
Here's a reference for why it can't be done in Java directly, but you could use JNI to escape out to a C library and return the result.