给你看个例子:
public class Test {
public static void main(String[] args) {
String str = "b"
byte[] bytes = str.getBytes()
for(byte b:bytes){
System.out.println(b)
System.out.println(Integer.toBinaryString(b))
}
}
}
private void method(){
byte[] buffer = { 22, 2, 0, 0, 0, 0, 0, 0, 0, 150, 0, 80, 0, 160, 0 }
using (FileStream fs = new FileStream(@"C:\BloodPressure.bin", FileMode.CreateNew, FileAccess.ReadWrite))
{
using (BinaryWriter writer = new BinaryWriter(fs))
{
writer.Write(buffer, 0, buffer.Length)
}
}
}
这样写经过了验证是ok的.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)