When I am using (encrypt/decrypt) javax.crypto.Cipher class for long string, some characters in output string are invalid.
//ecnryption
byte[] inputBytes = str.getBytes();
cypheredBytes = cipher.doFinal(inputString, 0, inputBytes, outputBytes, 0);
return new String(outputBytes, 0, cypheredBytes);
//decryption
byte[] inputBytes = str.getBytes();
cypheredBytes = cipher.doFinal (inputBytes, 0, inputBytes.length, outputBytes, 0);
return new String(outputBytes, 0, cypheredBytes);