【发布时间】:2011-06-16 23:28:25
【问题描述】:
我希望有人可以帮助我,我需要将一个字符串从下面的方法传递给下面的方法。我查看了互联网并让它在测试程序上运行,但似乎无法让它在我的上运行,已经 3 小时,3 页谷歌和一本书哈哈。对不起,如果这很容易,但我真的不知道。
我需要做什么...我需要将变量“Hex”从方法“WMDBAudio”传递给方法“hexConverter”。我希望这是有道理的,提前感谢您的帮助,这是很重要的!
public class WMDBAudio{
public String WMDBAudio1(String fileInfo) throws IOException{
//code removed as there is quite a lot
int m = 0;
while (m != 1){
for (int count = 0; count < 3; count++){
hexIn = in.read();
s = Integer.toHexString(hexIn);
if(s.length() < 2){
s = "0" + Integer.toHexString(hexIn);
}
temp = temp + s;
}
if ("000000".equalsIgnoreCase(temp)){
m = 1;
hex = entry;
}
entry = entry + temp;
temp = "";
}
}
}
//十六进制转换方法
public class hexConverter{
public static void hexConverter(String t){
WMDBAudio w = new WMDBAudio();
String hex = "";
StringBuilder output = new StringBuilder();
for (int i = 0; i < hex.length(); i+=2){
String str = hex.substring(i, i+2);
output.append((char)Integer.parseInt(str, 16));
}
System.out.println(output);
}
}
【问题讨论】:
-
这似乎是一项简单的任务,除非您所做的事情与您所描述的完全不同。只需调用 hexConverter.hexConverter(Hex) 就可以为您完成这项工作。您能否粘贴您遇到的异常。