What is the best way to convert a small endian to a large endian?
def i = 0x12345678; def j = 0x78563412; assert i == convert(j) // ?
I know that I can mask bytes and reorder them, but what is a more attractive way?
Good ol 'Java (SE5 +):
assert i == Integer.reverseBytes(j)
but Groovier:
def convert = Integer.&reverseBytes assert i == convert(j)
Source: https://habr.com/ru/post/1488954/More articles:Webdriver selenium setup with options and features - c #How to convert a dynamically linked application to statically? - linuxDecrypt encrypted value outside of Laravel - phpAndroid gradle and warnings roboguice 2.0 - androidServiceStack SOAP endpoint returning HTML code for validation error - .netImprove floating point parser accuracy - c ++How to get per_page model number in views? - ruby-on-railsCan I change the Designer.cs file? - c #FragmentPagerAdapter getItem wrong position - androidHide element if next is empty - cssAll Articles