// Copyright 2000 Jonathan White // Use/modify this however you want, just keep this and the previous line package mt.util; /* Tests to see if a string is an integer. Java does not natively provide a way of checking. Note this only test base 10 numbers not base 8 or 16. */ public class IntegerOp extends Object{ final public static CharMap cmap = new CharMap(256); static { cmap.setChars("0123456789", true); } final public static boolean isInteger(String value){ int l = value.length(); while(l > 0){ if(!cmap.contains(value.charAt(--l))) return false; } return true; } }