当前位置: 代码迷 >> J2EE >> 怎么将 112, 123, 98 这种long 型数据转换为字符串输出啊
  详细解决方案

怎么将 112, 123, 98 这种long 型数据转换为字符串输出啊

热度:413   发布时间:2016-04-22 00:40:54.0
如何将 112, 123, 98 这种long 型数据转换为字符串输出啊?
我是想读一个数,转换为字符,然后添加这个字符到当前字符串的开头:
Java code
for(int i =0; ....){                BigInteger temp = greatdecry[i].remainder(BigInteger.valueOf(128));                String tempstring = String.valueOf((char)temp.longValue());                 iString = iString.insert(0, tempstring);}


但是输出不对,有的字符时对的,有的不对...

------解决方案--------------------
//输入数字,然后每次把这个数字转换成字符串放在所有字符串的前面。
import javax.swing.JOptionPane;
public class test2
{
public static void main(String[] args)
{
String abc= " ";
String a= " ";
while(a!= "stop "){
a=JOptionPane.showInputDialog(null, "请输入数字 ");
abc=a+abc;
JOptionPane.showMessageDialog(null, "当前的值是 "+abc);
}
}
}

------解决方案--------------------
写法没问题啊,请问哪些字符不对呢。。。
  相关解决方案