code: public static boolean[] getKeyUsage(X509Extension ext)
  	throws IOException {
  	DERBitString bits = (DERBitString)getExtensionObject(ext);
  
  	// copied from X509CertificateObject
  	byte [] bytes = bits.getBytes();
  	int length = (bytes.length * 8) - bits.getPadBits();
  
  	boolean[]  keyUsage = new boolean[(length < 9) ? 9 : length];
  
  	for (int i = 0; i != length; i++) {
  	    keyUsage[i] = (bytes[i / 8] & (0x80 >>> (i % 8))) != 0;
  	}
  
  	return keyUsage;
      }
docs: Gets a boolean array representing bits of the KeyUsage extension.
  
  @see java.security.cert.X509Certificate#getKeyUsage
  @exception IOException if failed to extract the KeyUsage extension value.