先看Byte,是一个类:
public final class Byte
The Byte
class wraps a value of primitive type byte
in an object. An object of type Byte
contains a single field whose type is byte
.
In addition, this class provides several methods for converting a byte
to a String
and a String
to a byte
, as well as other constants and methods useful when dealing with a byte
.
byte是基本数据类型
Byte是byte的包装类
public class Main { /* * This method converts an byte array to a String object. */ public void convertByteArrayToString() { byte[] byteArray = new byte[] {87, 79, 87, 46, 46, 46}; String value = new String(byteArray); System.out.println(value); } /** * @param args the command line arguments */ public static void main(String[] args) { new Main().convertByteArrayToString(); } }
string 转byte【】
String str;
byte[] a=str.getBytes[];
总结: