Return a copySign of the first argument in Java

Description

The following code shows how to return a copySign of the first argument.

Example


/*w  ww .  ja v  a2  s.c  o  m*/
public class Main {
  public static void main(String[] args) {

    // Returns a copySign of the first argument
    double d = Math.copySign (1234.56, -1);
    System.out.println ("Math.copySign (1234.56, -1) = " + d);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Development »




Java Algorithms
Java Clipboard
Java Compiler
Java Desktop
Java Virtual Machine
Java Math
OS
Random
Java Robot
Java RuntimeMXBean
Java Timer
Java UUID
Java Internationalization