Java tutorial
//package com.java2s; public class Main { public static boolean canBeCompilerOptionValue(final String text) { if (text.startsWith("-")) { // option or negative number return text.length() > 1 && Character.isDigit(text.charAt(1)); } return !text.startsWith("+"); } }