Math (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.lang
Class Math

    java.lang.Object
      java.lang.Math

    @TransactionType(value=NOT_SUPPORTED)
    public final class Math

extends Object

The class `Math` contains methods for performing basic numeric operations.

Since:
  JDK1.0, CLDC 1.0, Java Card 3.0

Method Summary
`static int` | `abs(int a)` Returns the absolute value of an `int` value.
`static long` | `abs(long a)` Returns the absolute value of a `long` value.
`static int` | `max(int a, int b)` Returns the greater of two `int` values.
`static long` | `max(long a, long b)` Returns the greater of two `long` values.
`static int` | `min(int a, int b)` Returns the smaller of two `int` values.
`static long` | `min(long a, long b)` Returns the smaller of two `long` values.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### abs

    public static int abs(int a)

  Returns the absolute value of an `int` value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

  Note that if the argument is equal to the value of `Integer.MIN_VALUE`, the most negative representable `int` value, the result is that same value, which is negative.

  Parameters:
    `a` - an `int` value.
  Returns:
    the absolute value of the argument.
  See Also:
    `Integer.MIN_VALUE`

### abs

    public static long abs(long a)

  Returns the absolute value of a `long` value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

  Note that if the argument is equal to the value of `Long.MIN_VALUE`, the most negative representable `long` value, the result is that same value, which is negative.

  Parameters:
    `a` - a `long` value.
  Returns:
    the absolute value of the argument.
  See Also:
    `Long.MIN_VALUE`

### max

    public static int max(int a,
                          int b)

  Returns the greater of two `int` values. That is, the result is the argument closer to the value of `Integer.MAX_VALUE`. If the arguments have the same value, the result is that same value.

  Parameters:
    `a` - an `int` value.
    `b` - an `int` value.
  Returns:
    the larger of `a` and `b`.
  See Also:
    `Long.MAX_VALUE`

### max

    public static long max(long a,
                           long b)

  Returns the greater of two `long` values. That is, the result is the argument closer to the value of `Long.MAX_VALUE`. If the arguments have the same value, the result is that same value.

  Parameters:
    `a` - a `long` value.
    `b` - a `long` value.
  Returns:
    the larger of `a` and `b`.
  See Also:
    `Long.MAX_VALUE`

### min

    public static int min(int a,
                          int b)

  Returns the smaller of two `int` values. That is, the result the argument closer to the value of `Integer.MIN_VALUE`. If the arguments have the same value, the result is that same value.

  Parameters:
    `a` - an `int` value.
    `b` - an `int` value.
  Returns:
    the smaller of `a` and `b`.
  See Also:
    `Long.MIN_VALUE`

### min

    public static long min(long a,
                           long b)

  Returns the smaller of two `long` values. That is, the result is the argument closer to the value of `Long.MIN_VALUE`. If the arguments have the same value, the result is that same value.

  Parameters:
    `a` - a `long` value.
    `b` - a `long` value.
  Returns:
    the smaller of `a` and `b`.
  See Also:
    `Long.MIN_VALUE`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.