Java tutorial
//package com.java2s; /* * %W% %E% * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { public static boolean isPrintable(char c) { if (Character.isJavaIdentifierStart(c)) { // Letters and $ _ return true; } if (Character.isDigit(c)) { return true; } switch (Character.getType(c)) { case Character.MODIFIER_SYMBOL: return true; // ` ^ case Character.DASH_PUNCTUATION: return true; // - case Character.MATH_SYMBOL: return true; // = ~ + | < > case Character.OTHER_PUNCTUATION: return true; // !@#%&*;':",./? case Character.START_PUNCTUATION: return true; // ( [ { case Character.END_PUNCTUATION: return true; // ) ] } } return false; } }