The Java System class

  java.lang.System class provides a number of static methods that can obtain information related to the system or the operating system level.

Common Method 1:

public static long currentTimeMillis (): returns the current time in milliseconds.

  This method takes milliseconds difference between the current system time at 00:00 on January 1st, 1970 points

Common Method 2:

public static void arraycopy (Object src, int srcPos, Object dest, int destPos, int length) `: copy the specified data to the array of another array

   A copy operation of the array system-level, high performance.

   System.arraycopy method has five parameters, meaning respectively:

Parameters No. parameter name Parameter Type Parameter Meaning
1 src Object Source array
2 srcPos int Source array index start position
3 hand Object Target array
4 destPos int Destination array index of the starting position
5 length int Copy number of elements

  Demo:

. 1  Import java.util.Arrays;
 2  
. 3  public  class Demo11SystemArrayCopy {
 . 4      public  static  void main (String [] args) {
 . 5          int [] the src = new new  int [] {1,2,3,4,5 };
 . 6          int [] dest = new new  int [] {6,7,8,9,10 };
 . 7          System.arraycopy (the src, 0, dest, 0,. 3 );
 . 8          / * after executing the code: two elements in the array occurs change
 . 9           the src array element [1,2,3,4,5]
 10           dest array element [1,2,3,9,10]
 11          * / 
12     }
13 }

 

Guess you like

Origin www.cnblogs.com/niujifei/p/11415401.html