Tag: nsstringencoding

二进制到Java中的文本

我有一个带有二进制数据的string(1110100)我想把文本拿出来打印出来(1110100会打印“t”)。 我试过这个,它和我用来把文本转换成二进制文件的类似,但是根本不工作: public static String toText(String info)throws UnsupportedEncodingException{ byte[] encoded = info.getBytes(); String text = new String(encoded, "UTF-8"); System.out.println("print: "+text); return text; } 任何更正或build议将不胜感激。 谢谢!