001 package net.sourceforge.retroweaver.runtime.java.lang; 002 003 public class Byte_ { 004 005 private Byte_() { 006 // private constructor 007 } 008 009 private static Byte[] boxedVals = new Byte[256]; 010 011 // Small lookup table for boxed objects 012 // 013 // The spec says that the range should be from -127 to 128, 014 // but a byte's range is from -128 to 127. Neal Gafter seems to imply 015 // that this is a bug in the spec. 016 static { 017 for (int i = 0; i < 256; ++i) { 018 byte val = (byte) (i - 128); 019 boxedVals[i] = new Byte(val); // NOPMD by xlv 020 } 021 } 022 023 public static Byte valueOf(final byte val) { 024 return boxedVals[val + 128]; 025 } 026 027 }