public static DERBitString getInstance ( Object obj ) { if ( obj == null || obj instanceof DERBitString ) { return ( DERBitString ) obj ; } if ( obj instanceof ASN1OctetString ) { byte [ ] bytes = ( ( ASN1OctetString ) obj ) . getOctets ( ) ; int padBits = bytes [ 0 ] ; byte [ ] data = new byte [ bytes . length - 1 ] ; System . arraycopy ( bytes , 1 , data , 0 , bytes . length - 1 ) ; return new DERBitString ( data , padBits ) ; } if ( obj instanceof ASN1TaggedObject ) { return getInstance ( ( ( ASN1TaggedObject ) obj ) . getObject ( ) ) ; } throw new IllegalArgumentException ( "illegal object in getInstance: " + obj . getClass ( ) . getName ( ) ) ; }
return a Bit String from the passed in object