byte

    0热度

    1回答

    我在Java中有以下方法将一组四个字节的整型表示组合成一个长整型。 public static long addBytesToInt(int x1, int x2, int x3, int x4) { return ((x4 << 24) | (x3 << 16) | (x2 << 8) | (x1 & 0xFF)); } 但问题是,如果我将调用此方法,例如以下值: //1111

    1热度

    1回答

    我试图用python打印shell代码,但它添加了\x0a终止符。有没有终止符打印的方法? # cat test.py print(b'\x41\x41\x41\x41') # python test.py |xxd -g1 0000000: 41 41 41 41 0a AAAA. # python test.py | wc 1 1 5

    0热度

    1回答

    我有一个是在六e.g表示 4d42 b666 000a 0000 0000 0036 0000 0028 前4个字节表示,其我想提取值二进制文件。 我知道我可以用鼠标右键 std::ifstream is("img.bmp", std::ifstream::binary); uint64_t data = 0; is.read((char*)&data,4) 这将导致306015776

    -2热度

    2回答

    我有一个int数组int[] stegoBitsArray = {0,1,1,0,1,1,0,0,0,1,1,0,0,0,0,1...}我希望每个比特转换为字节并添加到字节数组我以后将转换为字符数组,因为01101100是字母“l”等就这么...所以我试图用的ByteBuffer但它抛出我BufferOverflowException这里是我的代码片段: int[] stegoBitsArray

    0热度

    1回答

    我现在有简单的功能 public static void convert() { for (int i = 0; i < byteArray.length; i++) { byteArray[i] = (byte) (byteArray[i] & ~(1 << 0)); String s = ("0000000" + Integer.toBinaryString

    0热度

    2回答

    我有2个类,第一个输入1和0的二进制字符串到标准输入,并将字符串分成长度为8的子字符串转换为字节,写到标准输出,像这样: byte b = (byte)Integer.parseInt(byteString, 2); System.out.write(b); System.out.flush(); 二是管道第一的输出,最终会变成字节回长二进制字符串,但目前我有它只是这样做: int nex

    0热度

    1回答

    我正在做一个任务,我有一个字节数组,我写入文件。 我希望能够通过与我做的相反的方式将字节数组从文件中取出,但我认为我没有得到正确的值。 这是写入文本文件 PrintWriter fw = new PrintWriter(new BufferedWriter(new FileWriter("tc.txt",true))); KeyPair keyPair = generateKeyPair();

    2热度

    1回答

    我想比较使用指针的2字节数组。 我将字节数组视为int指针来更快地运行(比较4个字节)。 public static bool DoBuffersEqual(byte[] first, byte[] second) { unsafe { fixed (byte* pfirst = first, psecond = second) {

    2热度

    4回答

    我尝试读取“bytefile”中的字节,将其更改为String并将其存储为“stringfile”。下面的代码是我的表现。 PrintWriter writer = new PrintWriter(new FileOutputStream(new File("stringfile"), true)); RandomAccessFile file = new RandomAccessFil

    -4热度

    3回答

    我正在使用人机接口设备协议从外部设备获取数据。我正在使用的库返回一个字节数组([u8; 64]),我想从一个字节中提取i7(这将在Rust中为i8)。 我要处理的字节中有两段不同的信息: 1位为另一件事情事情 其他7位(我有解码为符号整数) 。 你知道我能做些什么来达到这个目的吗?