A filter method using java