站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

Primitives (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util
Class Primitives

java.lang.Object
  extended byorg.jboss.util.Primitives

public final class Primitives
extends Object

Primitive utilities.

Version:
$Revision: 1.1.28.1 $
Author:
Jason Dillon

Constructor Summary
Primitives()
           
 
Method Summary
static boolean equals(byte[] a, byte[] b)
          Test the equality of two byte arrays.
static boolean equals(byte[] a, int abegin, byte[] b, int bbegin, int length)
          Test the equality of a given sub-section of two byte arrays.
static boolean equals(double a, double b)
          Test the equality of two doubles by converting their values into IEEE 754 floating-point "double format" long values.
static boolean equals(float a, float b)
          Test the equality of two doubles by converting their values into IEEE 754 floating-point "single precision" bit layouts.
static int toInt(long value)
          Safely convert a long into a int value.
static Boolean valueOf(boolean value)
          Get a Boolean from a boolean, equivalent to the java 1.4 method Boolean.valueOf(boolean)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Primitives

public Primitives()
Method Detail

valueOf

public static Boolean valueOf(boolean value)
Get a Boolean from a boolean, equivalent to the java 1.4 method Boolean.valueOf(boolean)

Parameters:
value - the boolean
Returns:
the Boolean equivalent

equals

public static boolean equals(double a,
                             double b)
Test the equality of two doubles by converting their values into IEEE 754 floating-point "double format" long values.

Parameters:
a - Double to check equality with.
b - Double to check equality with.
Returns:
True if a equals b.

equals

public static boolean equals(float a,
                             float b)
Test the equality of two doubles by converting their values into IEEE 754 floating-point "single precision" bit layouts.

Parameters:
a - Float to check equality with.
b - Float to check equality with.
Returns:
True if a equals b.

equals

public static boolean equals(byte[] a,
                             int abegin,
                             byte[] b,
                             int bbegin,
                             int length)
Test the equality of a given sub-section of two byte arrays.

Parameters:
a - The first byte array.
abegin - The begining index of the first byte array.
b - The second byte array.
bbegin - The begining index of the second byte array.
length - The length of the sub-section.
Returns:
True if sub-sections are equal.

equals

public static boolean equals(byte[] a,
                             byte[] b)
Test the equality of two byte arrays.

Parameters:
a - The first byte array.
b - The second byte array.
Returns:
True if the byte arrays are equal.

toInt

public static int toInt(long value)
                 throws DataConversionException
Safely convert a long into a int value.

If value is > Integer.MAX_VALUE or < Integer.MIN_VALUE then an exception will be thrown, else the value is cast down to an int.

Parameters:
value - The long value to convert.
Returns:
The converted value.
Throws:
DataConversionException - Could not safely convert the value.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.