notes intro/old projects AP Problems the dump links

Integer Class - api here


The integer class is a useful class to make an object out of an integer. We would use it if we needed to treat an integer(primitive data)as an object.



The key parts of it are:

  • Integer k=new Integer(15);

or it has an automatic wrapping ability so you actually could say: Integer k=15;

  • k.intValue() returns its value
    • or again we actually can say just k to get the value.


There is static methods that are incredibly useful:

  • Integer.parseInt("15") would return 15 - it can change a string to an int.

Also you NEED to know the static fields MAX_VALUE and MIN_VALUE:

  • Integer.MAX_VALUE is the maximum an integer can be (2 to the power of 31 minus 1 or 2,147,483,647)
  • Integer.MIN_VALUE is the min an integer can be (- 2 to the power of 31 or -2,147,483,648)

You could say int x=Integer.MAX_VALUE; to set it at the max pos value.