Java examples for Collection Framework:Array Length
repeat Asterisk by length and return a char array
//package com.java2s; public class Main { public static void main(String[] argv) { int len = 42; System.out.println(java.util.Arrays.toString(repeatAsterisk(len))); }/* ww w .j a v a2s . c om*/ private static final char SEPARATOR_CHAR_ASTERISK = '*'; private static char[] repeatAsterisk(int len) { char[] chars = new char[len]; for (int i = 0; i < len; i++) { chars[i] = SEPARATOR_CHAR_ASTERISK; } return chars; } }