我是想读一个数,转换为字符,然后添加这个字符到当前字符串的开头:for(int i =0; ....)
{
BigInteger temp = greatdecry[i].remainder(BigInteger.valueOf(128));
String tempstring = String.valueOf((char)temp.longValue()); 
iString = iString.insert(0, tempstring);
}
但是输出不对,有的字符时对的,有的不对...

解决方案 »

  1.   

    //输入数字,然后每次把这个数字转换成字符串放在所有字符串的前面。
    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);
             }
            }  
    }  
      

  2.   

    但是字符貌似是 ascii码 是7bit的?是这个原因吗?输入:
    Just because I am paranoid it doesn't mean that nobody
    is really out there trying to kill me. (Woody Allen) 编码,然后解码:
    输出:
    Just bgRBhN^J%8\Z7+
    ranoid"XU?iQ mONqW
    an thavOb=iU{<^)
    ally owcgC_BCFC
    g to kk[MH^W}(Fh0S"
     Allen+j|Zy)X'%-G3$