Convert Little Endian to Big Endian

前端 未结 13 1833
慢半拍i
慢半拍i 2020-11-27 16:34

I just want to ask if my method is correct to convert from little endian to big endian, just to make sure if I understand the difference.

I have a number which is st

13条回答
  •  抹茶落季
    2020-11-27 16:46

    Below is an other approach that was useful for me

    convertLittleEndianByteArrayToBigEndianByteArray (byte littlendianByte[], byte bigEndianByte[], int ArraySize){
        int i =0;
    
        for(i =0;i>1 & 0x08) | (littlendianByte[ArraySize-i-1] >> 3 & 0x04) |
                                (littlendianByte[ArraySize-i-1] >>5 & 0x02) | (littlendianByte[ArraySize-i-1] >> 7 & 0x01) ;
        }
    }
    

提交回复
热议问题