public int unpad(byte[] in,int off,int len){
  if ((in == null) || (len == 0)) {
    return 0;
  }
  byte lastByte=in[off + len - 1];
  int padValue=(int)lastByte & 0x0ff;
  if ((padValue < 0x01) || (padValue > blockSize)) {
    return -1;
  }
  int start=off + len - ((int)lastByte & 0x0ff);
  if (start < off) {
    return -1;
  }
  return start;
}

public int unpad ( byte [ ] in , int off , int len ) { if ( ( in == null ) || ( len == 0 ) ) { return 0 ; } byte lastByte = in [ off + len - 1 ] ; int padValue = ( int ) lastByte & 0x0ff ; if ( ( padValue < 0x01 ) || ( padValue > blockSize ) ) { return - 1 ; } int start = off + len - ( ( int ) lastByte & 0x0ff ) ; if ( start < off ) { return - 1 ; } return start ; }
returns the index where the padding starts . < p > given a buffer with padded data , this method returns the index where the padding starts .
