1 ImportJava.util.*;2 ImportJava.io.*;3 4 Public classMain {5 Public Static voidMain (string[] args)throwsioexception{6 //Calculate program Run time7 //Arrays8 LongSt =System.currenttimemillis ();9 if("abc" = = "abc") System.out.println ("Yes1");TenString str1 =NewString ("ABC"); OneString str2 =NewString ("ABC"); A if(str1 = = str2) System.out.println ("Yes2"); - if(Str1.equals (STR2)) System.out.println ("Yes3"); - the // - int[] t = {5, 1, 3, 2, 9}; - Arrays.sort (t); - System.out.println (arrays.tostring (t)); + int[] s =New int[10]; -Arrays.fill (S, 33); + System.out.println (arrays.tostring (s)); A //Returns ((-insertion point)-1) If key is not exists. atSystem.out.println (Arrays.binarysearch (T, 4)); - intCNT = 0; - for(inti = 1; i < 100000000; i++) {cnt++;} - Longed =System.currenttimemillis (); -System.out.println ("Time:" + (Ed-St)); - in //String Hash -String str =NewString ("Hello World"); toSystem.out.println ("Hash Code:" +Str.hashcode ()); + - //Bufferreader Buffering and line-wrapping read function theBufferedReader cin =NewBufferedReader (NewInputStreamReader (system.in)); * intsum = 0; $String SS =NULL;Panax Notoginseng while((ss = Cin.readline ())! =NULL) { -Sum + =Integer.parseint (ss); the } +System.out.println ("The sum is:" +sum); A the // + - } $}
Common Java Code for ACM