Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static boolean isRegistrationValid(String email) { if (email.length() != 11) return false; for (int i = 0; i < email.length(); i++) { if (i == 9) { if (email.charAt(i) != '-') return false; } else { if (!Character.isDigit(email.charAt(i))) return false; } } return true; } }