Java tutorial
//package com.java2s; /** * Source obtained from crypto-gwt. Apache 2 License. * https://code.google.com/p/crypto-gwt/source/browse/crypto-gwt/src/main/java/com/googlecode/ * cryptogwt/util/ByteArrayUtils.java */ import java.util.Arrays; public class Main { public static byte[] repeat(byte b, int nrRepeats) { byte[] result = new byte[nrRepeats]; Arrays.fill(result, b); return result; } }