public static UIAddress fromSatoshiStyle(String address) throws HyperLedgerException {
  try {
    Network network=Network.PRODUCTION;
    Address.Type type=Address.Type.COMMON;
    byte[] raw=ByteUtils.fromBase58(address);
    if ((raw[0] & 0xff) == 0x0) {
      network=Network.PRODUCTION;
      type=Address.Type.COMMON;
    }
    if ((raw[0] & 0xff) == 5) {
      network=Network.PRODUCTION;
      type=Address.Type.P2SH;
    }
    if ((raw[0] & 0xff) == 0x6f) {
      network=Network.TEST;
      type=Address.Type.COMMON;
    }
    if ((raw[0] & 0xff) == 196) {
      network=Network.TEST;
      type=Address.Type.P2SH;
    }
    byte[] check=Hash.hash(raw,0,raw.length - 4);
    for (int i=0; i < 4; ++i) {
      if (check[i] != raw[raw.length - 4 + i]) {
        throw new HyperLedgerException("Address checksum mismatch");
      }
    }
    byte[] keyDigest=new byte[raw.length - 5];
    System.arraycopy(raw,1,keyDigest,0,raw.length - 5);
    return new UIAddress(network,type,keyDigest);
  }
 catch (  Exception e) {
    throw new HyperLedgerException(e);
  }
}

public static UIAddress fromSatoshiStyle ( String address ) throws HyperLedgerException { try { Network network = Network . PRODUCTION ; Address . Type type = Address . Type . COMMON ; byte [ ] raw = ByteUtils . fromBase58 ( address ) ; if ( ( raw [ 0 ] & 0xff ) == 0x0 ) { network = Network . PRODUCTION ; type = Address . Type . COMMON ; } if ( ( raw [ 0 ] & 0xff ) == 5 ) { network = Network . PRODUCTION ; type = Address . Type . P2SH ; } if ( ( raw [ 0 ] & 0xff ) == 0x6f ) { network = Network . TEST ; type = Address . Type . COMMON ; } if ( ( raw [ 0 ] & 0xff ) == 196 ) { network = Network . TEST ; type = Address . Type . P2SH ; } byte [ ] check = Hash . hash ( raw , 0 , raw . length - 4 ) ; for ( int i = 0 ; i < 4 ; ++ i ) { if ( check [ i ] != raw [ raw . length - 4 + i ] ) { throw new HyperLedgerException ( "Address checksum mismatch" ) ; } } byte [ ] keyDigest = new byte [ raw . length - 5 ] ; System . arraycopy ( raw , 1 , keyDigest , 0 , raw . length - 5 ) ; return new UIAddress ( network , type , keyDigest ) ; } catch ( Exception e ) { throw new HyperLedgerException ( e ) ; } }
convert a human readable address string to an address object this conversion supports common and p2sh address types only .
