如下所示,我有以下代码作为我的构造函数。但我想用不同的名字复制它。但我在这方面遇到了错误。我可以以某种方式修改以适应要求吗?
这是原始代码:
public HeyStatus(byte[] bytes)
{
this();
int offset = 7;
for (int i = 1; i < 9; ++i)
{
partition1Status[i-1].status = (bytes[offset + i] & 0x0F);
partition2Status[i-1].status = (bytes[offset + i + 9] & 0x0F);
}
if( (bytes[offset + 9] == 0) || (bytes[offset + 9] == 1)){
isPartitioned = (bytes[offset + 9] == 0) ? false : true;
}
partition1Status.status = (bytes[offset + 18] - 0x30);
partition2Status.status = (bytes[offset + 19] - 0x30);
String model = "" + (char)bytes[1] + (char)bytes[2];
if (model.equalsIgnoreCase("!A"))
modelNum = "T32";
}
我想在前面的代码之后添加这段代码:
public HeyStatus(byte[] bytes2) <----the line I am getting error
{
this();
int offset = 7;
for (int i = 1; i < 9; ++i)
{
partition3Status[i-1].status = (bytes[offset + i] & 0x0F);
partition4Status[i-1].status = (bytes[offset + i + 9] & 0x0F);
}
if( (bytes[offset + 9] == 0) || (bytes[offset + 9] == 1)){
isPartitioned = (bytes[offset + 9] == 0) ? false : true;
}
partition3Status.status = (bytes[offset + 18] - 0x30);
partition4Status.status = (bytes[offset + 19] - 0x30);
String model = "" + (char)bytes[1] + (char)bytes[2];
if (model.equalsIgnoreCase("!A"))
modelNum = "T32";
}