How to convert byte[] c# to java byte[] -


i have code in c#

byte[] t = {6, 250, 215}.

but in java stay

byte[] t = {6, -6, -41}.

how solve problem. need in java equal c# byte[].

how solve problem

the 1st read how java represents data types..:

byte: byte data type 8-bit signed two's complement integer. has minimum value of -128 , maximum value of 127 (inclusive). byte data type can useful saving memory in large arrays, memory savings matters. can used in place of int limits clarify code; fact variable's range limited can serve form of documentation.

as @bradimus statements, java's byte 8-bits 2 complement signed int in c# never see negative byte value

hint:

if consider make conversion...

-6 in java can be 256+(-6) = 250 in c#

and consider max , min in java-byte if need convert c# java....


Comments