//Wrapper class > Integer class : example
class IntegerExam1 {
public static void main(String args[]) {
Integer num1 = new Integer(13);
Integer num2 = new Integer(25);
int hap = num1.intValue() + num2.intValue();
System.out.println("num1 wraps the integer: : " + num1.intValue());
System.out.println("num2 wraps the integer: : " + num2.intValue());
System.out.println("sum of two numbers = " + hap);
System.out.println("binary representation of the sum : " + Integer.toBinaryString(hap));
System.out.println("octal representation of the sum : " + Integer.toOctalString(hap));
System.out.println("if(num1 == num2) : " + num1.equals(num2));
Integer num3 = new Integer("444");
// creating integer object using string
System.out.println("value of string '444' is : " + num3.intValue());
}
}
//System class : example
class SystemExam {
public static void main(String args[]) {
long start,end;
start=System.currentTimeMillis();
System.out.println("current time :"+start);
System.out.println("5000times loopstart");
for(int i=0; i<5000; i++);
System.out.println("5000times loopend");
end=System.currentTimeMillis();
System.out.println(" loopendtime:" +end);
System.out.println(" loopelapsed time:" +(end-start))
;
}
}
