Java tutorial
//package com.java2s; public class Main { public static boolean isAlphabetOrNumeric(String value) { try { byte[] b = value.getBytes(); for (int i = 0; i < b.length; i++) { if (ascnum(b[i]) == false) return false; } return true; } catch (Exception e) { return false; } } private static boolean ascnum(byte byt) { // Asc: 48 - 57 = '0' -'9' // Asc: 65-90 = 'A' - 'Z' // Asc: 97-122 = 'a' - 'z' if ((byt >= 48 && byt <= 57) == false && (byt >= 65 && byt <= 90) == false && (byt >= 97 && byt <= 122) == false) return false; else return true; } }