public static byte[] decodeChecked(String input) throws ParseException {
  byte[] decoded=decode(input);
  if (decoded.length < 4) {
    throw new ParseException("Input too short",0);
  }
  byte[] data=Arrays.copyOfRange(decoded,0,decoded.length - 4);
  byte[] checksum=Arrays.copyOfRange(decoded,decoded.length - 4,decoded.length);
  byte[] actualChecksum=Arrays.copyOfRange(hashTwice(data),0,4);
  if (!Arrays.equals(checksum,actualChecksum)) {
    throw new ParseException("Checksum does not validate",0);
  }
  return data;
}

public static byte [ ] decodeChecked ( String input ) throws ParseException { byte [ ] decoded = decode ( input ) ; if ( decoded . length < 4 ) { throw new ParseException ( "Input too short" , 0 ) ; } byte [ ] data = Arrays . copyOfRange ( decoded , 0 , decoded . length - 4 ) ; byte [ ] checksum = Arrays . copyOfRange ( decoded , decoded . length - 4 , decoded . length ) ; byte [ ] actualChecksum = Arrays . copyOfRange ( hashTwice ( data ) , 0 , 4 ) ; if ( ! Arrays . equals ( checksum , actualChecksum ) ) { throw new ParseException ( "Checksum does not validate" , 0 ) ; } return data ; }
decodes the given base58 string into the original data bytes , using the checksum in the last 4 bytes of the decoded data to verify that the rest are correct . the checksum is removed from the returned data .
