Java tutorial
//package com.java2s; public class Main { public static boolean isNumeric(String operand) { operand = operand.toUpperCase(); if (operand.contains("0X")) { return operand.matches("0[xX][0-9a-fA-F]+"); } if (operand.contains("H")) { return operand.matches("\\d+[h|H]+"); } return operand.matches("\\d+"); } }