Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does Java convert a four-byte into an integer? And vice versa?
How does Java convert a four-byte into an integer? And vice versa?
byte[] b = {3,2, 1,9 };

String s = new string (b, "utf8"); Now convert 4 bytes into a string S.

Integer.parseInt(s), which converts the string into integer num,

String.valueOf(num), which converts the integer num into a string.

String to byte []

byte[]b = s . getbytes(" UTF8 ");