Java tutorial
//package com.java2s; public class Main { private static char[] getPaddedBytes(String source) { char[] converted = source.toCharArray(); int requiredLength = 3 * ((converted.length + 2) / 3); char[] result = new char[requiredLength]; System.arraycopy(converted, 0, result, 0, converted.length); return result; } }