Buggy code:
public class Name implements Comparable { private static final int LABEL_NORMAL = 0 ; private static final int LABEL_COMPRESSION = 192 ; private static final int LABEL_MASK = 192 ; private byte [ ] name ; private long offsets ; private int hashcode ; private static final byte [ ] emptyLabel = new byte [ ] { ( ( byte ) ( 0 ) ) } ; private static final byte [ ] wildLabel = new byte [ ] { ( ( byte ) ( 1 ) ) , ( ( byte ) ( '*' ) ) } ; public static final Name root ; public static final Name empty ; private static final int MAXNAME = 255 ; private static final int MAXLABEL = 63 ; private static final int MAXLABELS = 128 ; private static final int MAXOFFSETS = 7 ; private static final DecimalFormat byteFormat = new DecimalFormat ( ) ; private static final byte [ ] lowercase = new byte [ 256 ] ; private static final Name wild ; private Name ( ) { } private final void dump ( String prefix ) { } private final void setoffset ( int n , int offset ) { } private final int offset ( int n ) { } private final void setlabels ( int labels ) { } private final int getlabels ( ) { } private static final void copy ( Name src , Name dst ) { } private final void append ( byte [ ] array , int start , int n ) throws NameTooLongException { } private static TextParseException parseException ( String str , String message ) { } private final void appendFromString ( String fullName , byte [ ] array , int start , int n ) throws TextParseException { } private final void appendSafe ( byte [ ] array , int start , int n ) { } public Name ( String s , Name origin ) throws TextParseException { } public Name ( String s ) throws TextParseException { } public static Name fromString ( String s , Name origin ) throws TextParseException { } public static Name fromString ( String s ) throws TextParseException { } public static Name fromConstantString ( String s ) { } Name ( DNSInput in ) throws WireParseException { } public Name ( byte [ ] b ) throws IOException { } public Name ( Name src , int n ) { } public static Name concatenate ( Name prefix , Name suffix ) throws NameTooLongException { } public Name relativize ( Name origin ) { } public Name wild ( int n ) { } public Name fromDNAME ( DNAMERecord dname ) throws NameTooLongException { } public boolean isWild ( ) { } public boolean isAbsolute ( ) { } public short length ( ) { } public int labels ( ) { } public boolean subdomain ( Name domain ) { } private String byteString ( byte [ ] array , int pos ) { StringBuffer sb = new StringBuffer ( ) ; int len = array [ ( pos ++ ) ] ; for ( int i = pos ; i < ( pos + len ) ; i ++ ) { <START_BUG> short b = ( ( short ) ( ( array [ i ] ) & 255 ) ) ; <END_BUG> if ( ( b <= 32 ) || ( b >= 127 ) ) { sb . append ( '\\' ) ; sb . append ( Name . byteFormat . format ( b ) ) ; } else if ( ( ( ( ( ( ( ( b == '"' ) || ( b == '(' ) ) || ( b == ')' ) ) || ( b == '.' ) ) || ( b == ';' ) ) || ( b == '\\' ) ) || ( b == '@' ) ) || ( b == '$' ) ) { sb . append ( '\\' ) ; sb . append ( ( ( char ) ( b ) ) ) ; } else sb . append ( ( ( char ) ( b ) ) ) ; } return sb . toString ( ) ; } public String toString ( ) { } public byte [ ] getLabel ( int n ) { } public String getLabelString ( int n ) { } void toWire ( DNSOutput out , Compression c ) { } public byte [ ] toWire ( ) { } void toWireCanonical ( DNSOutput out ) { } public byte [ ] toWireCanonical ( ) { } void toWire ( DNSOutput out , Compression c , boolean canonical ) { } private final boolean equals ( byte [ ] b , int bpos ) { } public boolean equals ( Object arg ) { } public int hashCode ( ) { } public int compareTo ( Object o ) { } }

Fix:
int b = ( array [ i ] ) & 255 ;