java - Parse binary string as byte in JavaScript -
Is
A binary string like "11100011" to me and I have to change it in a byte wish I have Java is a working example below:
bytes B1 = (byte) integer. ParseInt ("11100011", 2); Println (b1); Here the output will be -29 . But if I wrote down some of the same code in JavaScript:
parseInt ( '11100011', 2); I get an output of 227 .
Why should I write a JavaScript code to get the output similar to Java? As
Java
Try it:
var b1 = parseInt ( '11100011', 2); If (B1> 127) B1 - = 256;
Comments
Post a Comment