public class GetIndexOfAtSignExample
{
	public int getIndexOfAtSign(String emailAddr)
	{
		int index;
		int length = emailAddr.length();
		for(index = 0; index < length; index++)
		{
			if(emailAddr.charAt(index) == '@')
			{
				return(index);
			}
		}
		return(-1);
	}
	
	public static void main(String args[])
	{
		System.out.println("GetIndexOfAtSignExample");
		GetIndexOfAtSignExample ex = new GetIndexOfAtSignExample();
		String email = "java.joe@sun.com";
		int retVal = ex.getIndexOfAtSign(email);
		System.out.println("Index of @ in " + email + ": " + retVal);
		email = "com!sun!java.joe";
		retVal = ex.getIndexOfAtSign(email);
		System.out.println("Index of @ in " + email + ": " + retVal);
	}
}
