Java examples for 2D Graphics:Font
generate LCD-like formatted number
//package com.java2s; public class Main { public static final String[] DIGITS = { " _ _ _ _ _ _ _ _ ", "| | | _| _||_||_ |_ ||_||_|", "|_| ||_ _| | _||_| ||_| _|" }; /**/*from w w w.ja v a2 s .c om*/ * @param number * String containing bank account number, ie. "070072772" * @return LCD-like formatted number according to KataBankOCR description */ public static String generate(String number) { String result = ""; for (int i = 0; i < 3; i++) { for (char character : number.toCharArray()) { Integer digit = Character.getNumericValue(character); result += DIGITS[i].substring(3 * digit, 3 * digit + 3); } result += "\n"; } // debug information to see how the digit actually looks System.out.println(result); return result; } }