Two common methods of class System

1. System.currentTimeMills () : get the current time from the time origin milliseconds , the return value is Long integer type.

Code demonstrates:

public class Demo4 {
    public static void main(String[] args) {
        long l = System.currentTimeMillis();
        System.out.println(l);
    }
}

operation result:

2. System.arrayCopy (src, srcPos, des, despos, length) : and the position number of the original length in srcPos length of subsequent array src copied to the target location despos array of des.

Code demonstrates:

Import java.util.Arrays; 

public  class Demo4 {
     public  static  void main (String [] args) {
         int [] A = {3,7,1,8,5 };
         int [] = {11,2,16 B , 7,9,0 };
         // the index of the array a position number 3 of the back 2 (8,5) to an index of the array b 2 on 
        System.arraycopy (a, 3, b, 2, 2 ); 
        System.out.println (of Arrays.toString (B)); 
    } 
}

operation result:

 

 note:

(1) the number of the original position on the target array is covered directly.

(2) from the array index 0 starts.

Guess you like

Origin www.cnblogs.com/iceywu/p/12016908.html