handling endian switch between java and obj-c