aspose file tools*
The moose likes Java in General and the fly likes negative integer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "negative integer" Watch "negative integer" New topic
Author

negative integer

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
Is it possible to turn a positive int or Integer into a negative value of the same amount eg. +60 into -60?
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Multiply by -1.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

the unary - operator does it:

Integer is a wrapper class and is immutable. You'd have to do something like this:


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: negative integer