Int - StarShipTutor/StarshipTutorAPCS GitHub Wiki

int : docs.oracle.com

Primitive Data Type - Integer

  • Contains - Signed Integer
  • Default - 0
  • Size - 32
  • Range - -2147483648 to 2147483647

Wrapper Class - Integer

The wrapper class Integer is used to crate an object out of an int.

There are many useful static and instance methods. Here are a few

int a, b;

Integer anInteger, anotherInteger;

String aString;
int theResult;

theResult = Integer.compare     ( a, b );           // Static Method
theResult = anInteger.compareTo ( anotherInteger ); // Instance Method

// There are many methods for converting Integers to Strings and vis versa 

// Static Methods

int radix; // in integer signifying the base, usually 2, 8, 10 or 16

a       = Integer.parseInt ( aString , radix ); // converts string to int
aString = Integer.toString ( a, radix );        // converts int to string 
aString = Integer.toHexString ( a );            // converts int to Hex 

// and Instance Methods

a       = anInteger.intValue ( ); // returns int value of Integer object
aString = anInteger.toString ();  // returns String of the Integer object

See the full list at docs.oracle.com