zno2

合并数组

 

import java.util.Arrays;

import org.junit.Test;

public class Xmltest {
    
    @Test
    public void xxx(){
        
        
        
        String[] left = {"0","1"};
        String[] right = {"2","3"};
        
        int ll = left.length;
        int rl = right.length;
        
        left = Arrays.copyOf(left, ll + rl);
        System.out.println(Arrays.asList(left));
        
        System.arraycopy(right, 0, left, rl , ll);
        System.out.println(Arrays.asList(left));
    }

}

 

结果:

[0, 1, null, null]
[0, 1, 2, 3]

 

posted on 2016-08-05 18:43  zno2  阅读(102)  评论(0编辑  收藏  举报

导航