Hello everyone,
I am having a small problem, does someone know how to break a long string into small groups of 3 characters. I've tried it but its not working.

Here's a sample of my code:

int begindex =0, endindex = 3;
    String plaintext = null;
    String block;
    StringBuffer sbplaintext = new StringBuffer();


    while ((input = fin.read()) != -1)   {
       sbplaintext.append((char) input);
    plaintext = sbplaintext.toString();

    for(int i=0; i < plaintext.length();i++){

        begindex += 3;
        endindex += 3;

I got a string buffer "sbplaintext", (convert into string) and my objective is to make a group a 3 chars.

Thanks in advance for your help.

I believe the String class has a toCharArray method that would help you. Then every 3 indexes are what you are looking for. Otherwise, use a for loop to add every substring of 3 chars to an array.