
java菜鸟 哪里错了
publicclassPMT{publicbyte[]getpmt(bytearray[]){intsection_len=(((array[1]&0xf)<<8)+ar...
public class PMT
{
public byte[] getpmt(byte array[])
{
int section_len=(((array[1] & 0xf) << 8) + array[2]);
int N=(section_len-9)/4;
for(int i=8;i<8+3N;i++)
{
int program_number=(array[i]<<8)+array[i+1];
System.out.println(Integer.toHexString(program_number&0xff));
}
return array;
}
}
for循环的i<8+3N中的N处报错:Syntax error on token "N", delete this token 展开
{
public byte[] getpmt(byte array[])
{
int section_len=(((array[1] & 0xf) << 8) + array[2]);
int N=(section_len-9)/4;
for(int i=8;i<8+3N;i++)
{
int program_number=(array[i]<<8)+array[i+1];
System.out.println(Integer.toHexString(program_number&0xff));
}
return array;
}
}
for循环的i<8+3N中的N处报错:Syntax error on token "N", delete this token 展开
2个回答
展开全部
for(int i=8;i<8+3N;i++)
里面的 3N乘法,两个乘数间的去处符是 * 符号,不能像数学里面那样直接写3N
改成 3 * N 即可。
里面的 3N乘法,两个乘数间的去处符是 * 符号,不能像数学里面那样直接写3N
改成 3 * N 即可。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询