-2

最近我收到了一个 Java 挑战,以获取存储了答案的字符串。我只是从 2 小时开始处理那个程序......我是 Java 的新手,我并不完全理解即将出现的错误以及如何修复它们这里是代码...

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    public static void main(String[] args) {
        int[] decoded = {0x00,0x00,0x00,0x14,0xA6,0x0A,0xCA,0xAD,0x6C,0x91,0x79,0x8E,0xB8,0xDE,0x91,0x30,0x5B,0xD9,0x29,0xCE,0xA5,0xEE,0x01,0x83,0xC3,0x54,0xA5,0x8D};
        b cls = new b("DarkWingDuckFTW!".getBytes());
        String ans= new String(cls.a(decoded));
    System.out.println(ans);
    }
}

class b
{
  private int[] b = new int[4];


  public b(byte[] paramArrayOfByte)
  { 
    int i=0;
    if (paramArrayOfByte == null)
      throw new RuntimeException("Error: null Key");
    if (paramArrayOfByte.length < 16)
      throw new RuntimeException("Error: Key too small");
    int j = 0;
    while (true)
    {
      if (i >= 4)
        return;
      int[] arrayOfInt = this.b;
      int k = j + 1;
      int m = 0xFF & paramArrayOfByte[j];
      int n = k + 1;
      int i1 = m | (0xFF & paramArrayOfByte[k]) << 8;
      int i2 = n + 1;
      int i3 = i1 | (0xFF & paramArrayOfByte[n]) << 16;
      j = i2 + 1;
      arrayOfInt[i] = (i3 | (0xFF & paramArrayOfByte[i2]) << 24);
      i++;
    }
  }

  void a(byte[] paramArrayOfByte, int[] paramArrayOfInt, int paramInt)
  {

    paramArrayOfInt[paramInt] = 0;
    int i = 24;
    int j = 0;
    if (j >= paramArrayOfByte.length)
      return;
    paramArrayOfInt[paramInt] |= (0xFF & paramArrayOfByte[j]) << i;
    if (i == 0)
    {
      paramInt++;
      if (paramInt >= paramArrayOfInt.length)
        break label96;
      paramArrayOfInt[paramInt] = 0;
      i = 24;
    }
    while (true)
    {
      j++;
      break;
      i -= 8;
      continue;
      label96: i = 24;
    }
  }

  void a(int[] paramArrayOfInt)
  {

    int i = 1;
    if (i >= paramArrayOfInt.length)
      return;
    int j = 32;
    int k = paramArrayOfInt[i];
    int m = paramArrayOfInt[(i + 1)];
    int n = k;
    int i1 = m;
    int i2 = -957401312;
    while (true)
    {
      int i3 = j - 1;
      if (j <= 0)
      {
        paramArrayOfInt[i] = n;
        paramArrayOfInt[(i + 1)] = i1;
        i += 2;
        break;
      }
      i1 -= (n ^ (n << 4) + this.b[2]) + (i2 ^ n >>> 5) + this.b[3];
      n -= (i1 ^ (i1 << 4) + this.b[0]) + (i2 ^ i1 >>> 5) + this.b[1];
      i2 += 1640531527;
      j = i3;
    }
  }

  public byte[] a(byte[] paramArrayOfByte)
  {

    int[] arrayOfInt = new int[paramArrayOfByte.length / 4];
    a(paramArrayOfByte, arrayOfInt, 0);
    a(arrayOfInt);
    return a(arrayOfInt, 1, arrayOfInt[0]);
  }

  byte[] a(int[] paramArrayOfInt, int paramInt1, int paramInt2)
  {

    byte[] arrayOfByte = new byte[paramInt2];
    int i = 0;
    int j = 0;
    int k = paramInt1;
    while (true)
    {
      if (i >= paramInt2)
        return arrayOfByte;
      arrayOfByte[i] = ((byte)(0xFF & paramArrayOfInt[k] >> 24 - j * 8));
      j++;
      if (j == 4)
      {
        k++;
        j = 0;
      }
      i++;
    }
  }
}

任何人请修复程序中的错误并附在此处...

错误是

Main.java:57: error: undefined label: label96
            break label96;
        ^
2 errors

提前致谢...

4

2 回答 2

0

您的a方法返回类型是void. 所以没有什么可以返回。所以你会收到这个错误信息。根据需要将您的a方法返回类型设置为string,int或等。然后你可以将它分配给一个变量并做任何你想做的事情。

于 2013-10-20T07:10:27.823 回答
-1

您关闭类 b 的花括号,然后继续定义新方法。您应该在类定义中声明您的方法。

于 2013-10-20T07:05:37.743 回答