Playing with bytes...need to convert from java to C#
Posted
by ibiza
on Stack Overflow
See other posts from Stack Overflow
or by ibiza
Published on 2010-04-28T01:30:33Z
Indexed on
2010/04/28
1:33 UTC
Read the original article
Hit count: 294
Hi fellow programmers,
I am not used to manipulate bytes in my code and I have this piece of code that is written in Java and I would need to convert it to its C# equivalent :
protected static final int putLong(final byte[] b, final int off, final long val) {
b[off + 7] = (byte) (val >>> 0);
b[off + 6] = (byte) (val >>> 8);
b[off + 5] = (byte) (val >>> 16);
b[off + 4] = (byte) (val >>> 24);
b[off + 3] = (byte) (val >>> 32);
b[off + 2] = (byte) (val >>> 40);
b[off + 1] = (byte) (val >>> 48);
b[off + 0] = (byte) (val >>> 56);
return off + 8;
}
Thanks in advance for all your help, I am looking forward to learn from this.
© Stack Overflow or respective owner