src/share/classes/java/lang/Long.java

Print this page




 744 
 745     /**
 746      * Returns the value of this {@code Long} as a
 747      * {@code double}.
 748      */
 749     public double doubleValue() {
 750         return (double)value;
 751     }
 752 
 753     /**
 754      * Returns a {@code String} object representing this
 755      * {@code Long}'s value.  The value is converted to signed
 756      * decimal representation and returned as a string, exactly as if
 757      * the {@code long} value were given as an argument to the
 758      * {@link java.lang.Long#toString(long)} method.
 759      *
 760      * @return  a string representation of the value of this object in
 761      *          base 10.
 762      */
 763     public String toString() {
 764         return String.valueOf(value);
 765     }
 766 
 767     /**
 768      * Returns a hash code for this {@code Long}. The result is
 769      * the exclusive OR of the two halves of the primitive
 770      * {@code long} value held by this {@code Long}
 771      * object. That is, the hashcode is the value of the expression:
 772      *
 773      * <blockquote>
 774      *  {@code (int)(this.longValue()^(this.longValue()>>>32))}
 775      * </blockquote>
 776      *
 777      * @return  a hash code value for this object.
 778      */
 779     public int hashCode() {
 780         return (int)(value ^ (value >>> 32));
 781     }
 782 
 783     /**
 784      * Compares this object to the specified object.  The result is




 744 
 745     /**
 746      * Returns the value of this {@code Long} as a
 747      * {@code double}.
 748      */
 749     public double doubleValue() {
 750         return (double)value;
 751     }
 752 
 753     /**
 754      * Returns a {@code String} object representing this
 755      * {@code Long}'s value.  The value is converted to signed
 756      * decimal representation and returned as a string, exactly as if
 757      * the {@code long} value were given as an argument to the
 758      * {@link java.lang.Long#toString(long)} method.
 759      *
 760      * @return  a string representation of the value of this object in
 761      *          base&nbsp;10.
 762      */
 763     public String toString() {
 764         return toString(value);
 765     }
 766 
 767     /**
 768      * Returns a hash code for this {@code Long}. The result is
 769      * the exclusive OR of the two halves of the primitive
 770      * {@code long} value held by this {@code Long}
 771      * object. That is, the hashcode is the value of the expression:
 772      *
 773      * <blockquote>
 774      *  {@code (int)(this.longValue()^(this.longValue()>>>32))}
 775      * </blockquote>
 776      *
 777      * @return  a hash code value for this object.
 778      */
 779     public int hashCode() {
 780         return (int)(value ^ (value >>> 32));
 781     }
 782 
 783     /**
 784      * Compares this object to the specified object.  The result is