gpt4 book ai didi

Java:错误 "Incompatible datatypes"

转载 作者:行者123 更新时间:2023-11-29 06:23:27 25 4
gpt4 key购买 nike

private byte[] decode_text(byte[] image)
{
int length = 0;
int offset = 32;
for(int i=0; i<32; ++i)
{
length = (length << 1) | (image[i] & 1);
}
byte[] result = new byte[length];
for(int b=0; b<result.length; ++b )
{
for(int i=0; i<8; ++i, ++offset)
{
/* I'm getting error at the following line */
result = (byte)((result << 1) | (image[offset] & 1));
}
}
return result;
}

错误是不兼容的数据类型......需要字节 [] 并找到字节............

最佳答案

您不能对 result 变量进行位移,因为它是一个字节数组。

关于Java:错误 "Incompatible datatypes",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2041045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com