Skip to content
Advertisement

ByteBuffer.wrap().getInt() equivalent in c#

Java

JavaScript

Output: 1397566791

C#

JavaScript

Output: 1194151251

I have no idea how to get the same output

Thanks

Advertisement

Answer

Well, Int32 consists of 4 bytes only, let’s Take them with the help of Take(4). Next, we have to take ending (Big or Little) into account and Reverse these 4 bytes if necessary:

JavaScript
Advertisement