我有一个GUI,我尝试将EBCDIC字符串转换为十六进制,但我得到了NumberforamtException。
ebcdichex.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ausgabe6.setText("");
String hexadecimal3 = eingabe4.getText().replace("\n", "");
byte[] chars2;
try {
chars2 = hexadecimal3.getBytes("IBM-273");
StringBuilder hexa2 = new StringBuilder();
for(int i = 0;i<chars2.length;i++){
byte[] b = {(byte) Integer.parseInt(""+chars2.toString(),16)};
hexa2.append(b);
}
ausgabe6.append(hexa2.toString());
}
catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
}
});
例外:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For
input string: "[B@1d05c81"
有谁知道我的错在哪里?