{
addressFlag = 0x5;
}
else
{
throw new ValidationException ("unknown address type");
}
}
else if ( address.getNetwork () == Network.TEST )
{
if ( address.getType () == Address.Type.COMMON )
{
addressFlag = 0x6f;
}
else if ( address.getType () == Address.Type.P2SH )
{
addressFlag = 196;
}
else
{
throw new ValidationException ("unknown address type");
}
}
else
{
throw new ValidationException ("unknown network");
}
byte[] addressBytes = new byte[1 + keyDigest.length + 4];
addressBytes[0] = (byte) (addressFlag & 0xff);
System.arraycopy (keyDigest, 0, addressBytes, 1, keyDigest.length);
byte[] check = Hash.hash (addressBytes, 0, keyDigest.length + 1);