class TestArr{
public static void main(String[] arg){
String a="aabbccddeeff";
String[] str=new String[3];
System.out.println(a.length());
int count=0;
for(int i=0;i<a.length();i++){
int index=i%4;
if(index==0){
str[count]=a.substring(count*4,(count+1)*4);
count++;
}
}
for(int j=0;j<str.length;j++)
System.out.println(str[j]);}
}

解决方案 »

  1.   

    用split()很容易实现的!你看一下API  :P
      

  2.   

    顶 jdk api  split()
      

  3.   

    String a="aabbccddeeff";
          String b[]=new String[ 20];
          for (int i=0;(i<a.length()/4);i++)
          {
            b[i]=a.substring(i*4,i*4+4);
          }
      

  4.   

    如果JDK版本低的话,就只能自己写程序,不能用split()了。
      

  5.   

    很好做啊, nouveau(路漫漫其修远兮)的方法就很好啊
      

  6.   

    to:nouveau(路漫漫其修远兮)如果a是一个不定长的四赴川怎么办啊?谢谢高手