Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
    Bookmark Topic Watch Topic
  • New Topic

method to convert positive number to negative  RSS feed

 
varun bihani
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is there any prebuilt function in java that convert positive number to negative number ??
eg, abs() convert negative to positive.. .
 
Nick White
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi!

Not sure this is the correct forum!

Perhaps you can move it to Java General (Beginners)?

This is the Cattle Drive - does it relate to a specific assignment?
 
varun bihani
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Report post to moderator
actually yes.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm not sure if there's a built in method, but it would be trivial to write one. If you multiply the absolute value of a number by -1, you'll always end up with a negative number of the desired magnitude.
 
Nick White
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Report post to moderator
varun bihani
actually yes


Great! - i'm doing the cattle ranch! - which assignment does your question relate?

Regards
 
Nick White
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm sorry - I hadn't realised you had already posted the same question to the Java in General forum. I apologise - I think this thread could now close, bartender!

I understand that threads should only be posted in one forum.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue under the Java in General cross-post. (And please don't cross-post.)
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!