Very interesting task, here I suggest this option.
Update
The previous version worked with English. characters of 1 byte, the new version of the code works with any. Accordingly, if you need to decompose an Object, you can change the received parameter to Object in the getList method, get the bytes in str_b from Object and send it on a trip using the method.
package demo; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static void main(String[] args) { String str = "Arguments: Привет [-PcmdLineArgs=, Привет -PjvmLineArgs=, Привет -c, /home/ufo/NetBeansПриветProjects/Demo/settings.gradle]"; System.out.println("str byte len = " + str.getBytes().length); for(byte[] item : getList(str, 12)){ // Debug System.out.println("item len = " + item.length); System.out.println(new String(item, StandardCharsets.UTF_8)); } } // Метод getList(String, int) принимает на вход 2 параметра: // 1. Строка // 2. Размер массива static List<byte[]> getList(String str, int len) { List<byte[]> list = new ArrayList<>(); byte[] str_b = str.getBytes(); int count = (int)Math.ceil((double)str_b.length / len); System.out.println("count = " + count); int start_position = 0; int end_position = len; for(int i = 1; i <= count; i++) { //Примечание: end_position - Этот индекс может находиться вне массива. list.add(Arrays.copyOfRange(str_b, start_position, end_position)); start_position += len; end_position = start_position + len; } return list; } }