public static boolean isInteger(String string) {
        if (string == null || string.isEmpty()) {
            return false;
        }

        int i = 0;
        if (string.charAt(0) == '-') {
            if (string.length() > 1) {
                i++;
            } else {
                return false;
            }
        }

        for (; i < string.length(); i++) {
            char c = string.charAt(i);

            if (!Character.isDigit(c)) {
                return false;
            }
        }

        try {
            Integer.parseInt(string);
        } catch (Exception ex) {
            return false;
        }

        return true;
    }