Short class


  public final class Short
extends Number
implements Comparable<Short>

The Short class wraps the short value in an object. Short class provides several methods for converting a short to a String and a String to a short.

Constants defined by Short class

TypeFieldSummary
static shortMAX_VALUEA constant holding the maximum value a short can have, 215-1.
static shortMIN_VALUEA constant holding the minimum value a short can have, -215.
static intSIZEThe number of bits used to represent a short value in two's complement binary form.
static Class<Short>TYPEThe Class instance representing the primitive type short.

Constructors from Short class

ConstructorSummary
Short(short value)Creates a Short object that represents the specified short value.
Short(String s)Creates a Short object that represents the short value indicated by the String parameter.

Methods from Shorts class for converting short value to byte, double, float, int, long and short

ReturnMethodSummary
bytebyteValue()Returns the value of this Short as a byte.
doubledoubleValue()Returns the value of this Short as a double.
floatfloatValue()Returns the value of this Short as a float.
intintValue()Returns the value of this Short as an int.
longlongValue()Returns the value of this Short as a long.
shortshortValue()Returns the value of this Short as a short.

Converting Short to string

ReturnMethodSummary
StringtoString()Returns a String object representing this Short's value.
static StringtoString(short s)Returns a new String object representing the specified short.

Convert string to short value

ReturnMethodSummary
static Shortdecode(String nm)Decodes a String into a Short.
static shortparseShort(String s)Parses the string argument as a signed decimal short.
static shortparseShort(String s, int radix)Parses the string argument as a signed short in the radix specified by the second argument.
static shortreverseBytes(short i)Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified short value.
static ShortvalueOf(short s)Returns a Short instance representing the specified short value.
static ShortvalueOf(String s)Returns a Short object holding the value given by the specified String.
static ShortvalueOf(String s, int radix)Returns a Short object holding the value extracted from the specified String when parsed with the radix given by the second argument.

Compare two Short objects

ReturnMethodSummary
intcompareTo(Short anotherShort)Compares two Short objects numerically.
booleanequals(Object obj)Compares this object to the specified object.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.