/[classpath]/classpath/java/lang/Byte.java
ViewVC logotype

Diff of /classpath/java/lang/Byte.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by mark, Sat Jul 2 20:32:38 2005 UTC revision 1.25 by tromey, Sat Sep 17 21:58:41 2005 UTC
# Line 50  package java.lang; Line 50  package java.lang;
50   * @author Per Bothner   * @author Per Bothner
51   * @author Eric Blake (ebb9@email.byu.edu)   * @author Eric Blake (ebb9@email.byu.edu)
52   * @since 1.1   * @since 1.1
53   * @status updated to 1.4   * @status updated to 1.5
54   */   */
55  public final class Byte extends Number implements Comparable  public final class Byte extends Number implements Comparable
56  {  {
# Line 78  public final class Byte extends Number i Line 78  public final class Byte extends Number i
78    public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');    public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');
79    
80    /**    /**
81       * The number of bits needed to represent a <code>byte</code>.
82       * @since 1.5
83       */
84      public static final int SIZE = 8;
85    
86      // This caches Byte values, and is used by boxing conversions via
87      // valueOf().  We're required to cache all possible values here.
88      private static Byte[] byteCache = new Byte[MAX_VALUE - MIN_VALUE + 1];
89    
90      /**
91     * The immutable value of this Byte.     * The immutable value of this Byte.
92     *     *
93     * @serial the wrapped byte     * @serial the wrapped byte
# Line 192  public final class Byte extends Number i Line 202  public final class Byte extends Number i
202    }    }
203    
204    /**    /**
205       * Returns a <code>Byte</code> object wrapping the value.
206       * In contrast to the <code>Byte</code> constructor, this method
207       * will cache some values.  It is used by boxing conversion.
208       *
209       * @param val the value to wrap
210       * @return the <code>Byte</code>
211       *
212       * @since 1.5
213       */
214      public static Byte valueOf(byte val)
215      {
216        synchronized (byteCache)
217          {
218        if (byteCache[val - MIN_VALUE] == null)
219          byteCache[val - MIN_VALUE] = new Byte(val);
220        return byteCache[val - MIN_VALUE];
221          }
222      }
223    
224     /**
225     * Convert the specified <code>String</code> into a <code>Byte</code>.     * Convert the specified <code>String</code> into a <code>Byte</code>.
226     * The <code>String</code> may represent decimal, hexadecimal, or     * The <code>String</code> may represent decimal, hexadecimal, or
227     * octal numbers.     * octal numbers.

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26