Forum Stats

  • 3,770,515 Users
  • 2,253,129 Discussions
  • 7,875,493 Comments

Discussions

How do you Invert signed numbers?

843789
843789 Member Posts: 46,655 Green Ribbon
edited Sep 3, 2009 6:36PM in New To Java
Hi there.

A simple question: How can I invert the sign of an integer? ie) convert -12 to +12? No doubt there is a really simple way to do this, but I'm stumped, I cannot find anything and I've been working on this program all day.

I'll be very grateful to anyone who can let me know if Java provides a way to do this, or point me in the right direction if it takes some tweaking of binary numbers using the Math package or something.

Cheers!
«134

Comments

This discussion has been closed.