Intel

Developer Zone

Character

java.lang

Class Character



  • public final class Character
    extends Object
    • Field Summary

      Fields
      Modifier and Type Field and Description
      static int MAX_RADIX
      The maximum radix used for conversions between characters and integers.
      static char MAX_VALUE
      The maximum Character value.
      static int MIN_RADIX
      The minimum radix used for conversions between characters and integers.
      static char MIN_VALUE
      The minimum Character value.
    • Constructor Summary

      Constructors
      Constructor and Description
      Character(char value)
      Constructs a new Character with the specified primitive char value.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      char charValue()
      Gets the primitive value of this character.
      static int digit(char c, int radix)
      Convenience method to determine the value of the specified character c in the supplied radix.
      boolean equals(Object object)
      Compares this object with the specified object and indicates if they are equal.
      int hashCode()
      Returns an integer hash code for this character.
      static boolean isDigit(char c)
      Indicates whether the specified character is a digit.
      static boolean isLowerCase(char c)
      Indicates whether the specified character is a lower case letter.
      static boolean isUpperCase(char c)
      Indicates whether the specified character is an upper case letter.
      static char toLowerCase(char c)
      Returns the lower case equivalent for the specified character if the character is an upper case letter.
      String toString()
      Converts this character to its string representation.
      static char toUpperCase(char c)
      Returns the upper case equivalent for the specified character if the character is a lower case letter.
      static Character valueOf(char c)
      Returns a Character instance for the char value passed.
    • Field Detail

      • MIN_VALUE

        public static final char MIN_VALUE
        The minimum Character value.
        See Also:
        Constant Field Values
      • MAX_VALUE

        public static final char MAX_VALUE
        The maximum Character value.
        See Also:
        Constant Field Values
      • MIN_RADIX

        public static final int MIN_RADIX
        The minimum radix used for conversions between characters and integers.
        See Also:
        Constant Field Values
      • MAX_RADIX

        public static final int MAX_RADIX
        The maximum radix used for conversions between characters and integers.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Character

        public Character(char value)
        Constructs a new Character with the specified primitive char value.
        Parameters:
        value - the primitive char value to store in the new instance.
    • Method Detail

      • charValue

        public char charValue()
        Gets the primitive value of this character.
        Returns:
        this object's primitive value.
      • valueOf

        public static Character valueOf(char c)
        Returns a Character instance for the char value passed. For ASCII/Latin-1 characters (and generally all characters with a Unicode value up to 512), this method should be used instead of the constructor, as it maintains a cache of corresponding Character instances.
        Parameters:
        c - the char value for which to get a Character instance.
        Returns:
        the Character instance for c.
        Since:
        1.5
      • equals

        public boolean equals(Object object)
        Compares this object with the specified object and indicates if they are equal. In order to be equal, object must be an instance of Character and have the same char value as this object.
        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare this double with.
        Returns:
        true if the specified object is equal to this Character; false otherwise.
        See Also:
        Object.hashCode()
      • toString

        public String toString()
        Converts this character to its string representation.
        Overrides:
        toString in class Object
        Returns:
        the character converted to a string.
      • digit

        public static int digit(char c,
                int radix)
        Convenience method to determine the value of the specified character c in the supplied radix. The value of radix must be between MIN_RADIX and MAX_RADIX.
        Parameters:
        c - the character to determine the value of.
        radix - the radix.
        Returns:
        the value of c in radix if radix lies between MIN_RADIX and MAX_RADIX; -1 otherwise.
      • isDigit

        public static boolean isDigit(char c)
        Indicates whether the specified character is a digit.
        Parameters:
        c - the character to check.
        Returns:
        true if c is a digit; false otherwise.
      • isLowerCase

        public static boolean isLowerCase(char c)
        Indicates whether the specified character is a lower case letter.
        Parameters:
        c - the character to check.
        Returns:
        true if c is a lower case letter; false otherwise.
      • isUpperCase

        public static boolean isUpperCase(char c)
        Indicates whether the specified character is an upper case letter.
        Parameters:
        c - the character to check.
        Returns:
        true if c is a upper case letter; false otherwise.
      • toLowerCase

        public static char toLowerCase(char c)
        Returns the lower case equivalent for the specified character if the character is an upper case letter. Otherwise, the specified character is returned unchanged.
        Parameters:
        c - the character
        Returns:
        if c is an upper case character then its lower case counterpart, otherwise just c.
      • toUpperCase

        public static char toUpperCase(char c)
        Returns the upper case equivalent for the specified character if the character is a lower case letter. Otherwise, the specified character is returned unchanged.
        Parameters:
        c - the character to convert.
        Returns:
        if c is a lower case character then its upper case counterpart, otherwise just c.