a = br.readLine();
int i = 0 ;
int ll[];
for(i = 0;i<=a.length;i++)
{
  ll[i] = Integer.parseInt(a.substring(i,i+1));
}

解决方案 »

  1.   

    byte []t = a.getBytes();
    int  []A = new int[t.length];
    A[i]=t[i];
      

  2.   

    int[] a = new int [1024];
    int j = 0;System.out.print ("输入第一个数:");
    i = System.in.read ();
    while (i != 13)
    {
    if (((i >= 48) && (i <= 57)))
    {
    a [j] Integer.parseInt ((char) i);
    j ++;
    }

    i = System.in.read ();
    }
      

  3.   

    package stringbuffer;import java.io.*;public class StringBuffer{
      public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String a = null;
        System.out.println("pls input number");
        a = br.readLine();
        Integer.parseInt(a);
        char[] c = new char[a.length()];
        for (int i = 0; i < a.length(); i++) {
          c[i] = a.charAt(i);
          System.out.println("c[" + i + "]= " + c[i]);
        }
      }
    }
      

  4.   

    把输入的字符串数字转变成字符数组,通过一个循环,把每个字符转变成int型,付给int数组即可了
      

  5.   

    我改成这样了,还是不成,出来的数乱七八糟的,不是我要实现的结果。将输入的字符串的每位变为一个整数数组。如:字符串 1100, 变为A[0]=1,A[2]=1,A[3]=0,A[4]=0;按照字符串每位的顺序。import java.io.*;
    public class StringBuffer  {
    public static void main(String[] args) throws Exception
    {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String a = new String();
    System.out.println("pls input number");
        a = br.readLine();
       
       /*int i = 0 ;
           int ll[];
           for(i = 0;i<=a.length;i++)
           {
           ll[i] = Integer.parseInt(a.substring(i,i+1));
           }*/
           int i=0;
           byte []t = a.getBytes();
           int  []A = new int[t.length];
           A[i]=t[i];
           for(int j=0;j<A.length;j++)
           System.out.println(A[j]);

    }
    }
      

  6.   

    你想看到什么样的结果,我看到你代码中int ll[];赋值后再没有使用?你为什么不把
    /*int i = 0 ;
           int ll[];
           for(i = 0;i<=a.length;i++)
           {
           ll[i] = Integer.parseInt(a.substring(i,i+1));
           }*/
           int i=0;
           byte []t = a.getBytes();
           int  []A = new int[t.length];
           A[i]=t[i];
           for(int j=0;j<A.length;j++)
           System.out.println(A[j]);
    写成:
           int[] ll = new int(a.length);
           for( int i = 0;i<=a.length;i++)
           {
             ll[i] = Integer.parseInt(a.substring(i,i+1));
           }
           for(int j=0;j<ll.length;j++)
           System.out.println(ll[j]);
      

  7.   

    有个地方写错了,因该是int[] ll = new int[a.length];