aspose file tools
The moose likes Beginning Java and the fly likes Integer and int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Integer and int" Watch "Integer and int" New topic

Integer and int

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
Is that true, that Integer can only handles value between −32.768 till 32.767 and unsigned till 65.535.

And int can handle values till 4.294.967.295 (unsigned) ?
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
Hi Nimo

Try this:


What do you get?

For your other question about int type:

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14667

Java does not have unsigned integer types (apart from char) like C or C++ has.

And what you say about Integer is not correct; class Integer is just a wrapper class for int. See The Numbers Classes in Sun's Java Tutorials.

An int in Java is 32 bits and is encoded in [url=]two's complement[/url] format, so it can hold values from -2^31 to 2^31 - 1.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Have you tried LearnNowOnline?
subject: Integer and int