protected static Long convertStringToBuckectingLong(String stringToBeConverted){
  if (stringToBeConverted == null || stringToBeConverted.equals("")) {
    return null;
  }
  byte[] byteString=stringToBeConverted.getBytes();
  if (byteString.length < 8) {
    byte[] newByteString=new byte[8];
    for (int i=0; i < newByteString.length; i++) {
      if (i < byteString.length) {
        newByteString[i]=byteString[i];
      }
 else {
        newByteString[i]=0;
      }
    }
    byteString=newByteString;
  }
  ByteBuffer bb=ByteBuffer.wrap(byteString);
  long byteMethod=bb.getLong();
  byteMethod=Math.abs(byteMethod);
  return byteMethod;
}

protected static Long convertStringToBuckectingLong ( String stringToBeConverted ) { if ( stringToBeConverted == null || stringToBeConverted . equals ( "" ) ) { return null ; } byte [ ] byteString = stringToBeConverted . getBytes ( ) ; if ( byteString . length < 8 ) { byte [ ] newByteString = new byte [ 8 ] ; for ( int i = 0 ; i < newByteString . length ; i ++ ) { if ( i < byteString . length ) { newByteString [ i ] = byteString [ i ] ; } else { newByteString [ i ] = 0 ; } } byteString = newByteString ; } ByteBuffer bb = ByteBuffer . wrap ( byteString ) ; long byteMethod = bb . getLong ( ) ; byteMethod = Math . abs ( byteMethod ) ; return byteMethod ; }
converts a string into long values takes the first 8 bytes and uses those to convert them into long , if the string does not contain 8 bytes we pad them with zeros
