import java.util.Date;

/**
 * A fix-sized array of students
 * array length should always be equal to the number of stored elements
 * after the element was removed the size of the array should be equal to the number of stored elements
 * after the element was added the size of the array should be equal to the number of stored elements
 * null elements are not allowed to be stored in the array
 * 
 * You may add new methods, fields to this class, but DO NOT RENAME any given class, interface or method
 * DO NOT PUT any classes into packages
 *
 */
public class StudentGroup implements StudentArrayOperation {

	private Student[] students;
	
	/**
	 * DO NOT remove or change this constructor, it will be used during task check
	 * @param length
	 */
	public StudentGroup(int length) {
		this.students = new Student[length];
	}

	@Override
	public Student[] getStudents() {
		// Add your implementation here
		return this.students;
	}

	@Override
	public void setStudents(Student[] students) {
		this.students = students;// Add your implementation here
	}

	@Override
	public Student getStudent(int index) {
		if(index<0 || index >= students.length)
		throw new IllegalArgumentException("invalid index");
	else

		return students[index];
	}

	@Override
	public void setStudent(Student student, int index) {
		if(student == null || index<0 || index >= students.length)
		throw new IllegalArgumentException("invalid index");
		else
		{
			students[index] = student;
		}
	}

	@Override
	public void addFirst(Student student) {
		// Add your implementation here
	}

	@Override
	public void addLast(Student student) {
		// Add your implementation here
	}

	@Override
	public void add(Student student, int index) {
		// Add your implementation here
	}

	@Override
	public void remove(int index) {
		// Add your implementation here
	}

	@Override
	public void remove(Student student) {
		// Add your implementation here
	}

	@Override
	public void removeFromIndex(int index) {
		// Add your implementation here
	}

	@Override
	public void removeFromElement(Student student) {
		// Add your implementation here
	}

	@Override
	public void removeToIndex(int index) {
		// Add your implementation here
	}

	@Override
	public void removeToElement(Student student) {
		// Add your implementation here
	}

	@Override
	public void bubbleSort() {
		// Add your implementation here
	}

	@Override
	public Student[] getByBirthDate(Date date) {
		// Add your implementation here
		return null;
	}

	@Override
	public Student[] getBetweenBirthDates(Date firstDate, Date lastDate) {
		// Add your implementation here
		return null;
	}

	@Override
	public Student[] getNearBirthDate(Date date, int days) {
		// Add your implementation here
		return null;
	}

	@Override
	public int getCurrentAgeByDate(int indexOfStudent) {
		// Add your implementation here
		return 0;
	}

	@Override
	public Student[] getStudentsByAge(int age) {
		// Add your implementation here
		return null;
	}

	@Override
	public Student[] getStudentsWithMaxAvgMark() {
		// Add your implementation here
		return null;
	}

	@Override
	public Student getNextStudent(Student student) {
		if(student==null)
			throw new IllegalArgumentException("invalid parameter");
		else
		{
		
		int flag=0;
		for(int i=0;i<students.length-1;i++)
		{
			if(students[i]==student)
			{
				flag=1;
				return students[i+1];
			}
		}
		if(flag==0)
			throw new IllegalArgumentException("do not exists");
			
			
		}
	}
}

@@ -3272,24 +3272,60 @@
 student) %7B%0D%0A
+%09%09int flag=0,j= students.length-1;%0D%0A
 %09%09if(student
@@ -3324,18 +3324,20 @@
 (student
+ 
 ==
+ 
 null)%0D%0A%09
@@ -3419,54 +3419,27 @@
 %0D%0A%09%09
-int flag=0;%0D%0A%09%09for(int i=0;i%3Cstudents.length-1
+for(int i = 0 ; i%3Cj
 ;i++
@@ -3463,18 +3463,20 @@
 dents%5Bi%5D
+ 
 ==
+ 
 student)
@@ -3495,17 +3495,19 @@
 flag
-=
+ = 
 1;%0D%0A%09%09%09%09
 retu
@@ -3506,28 +3506,27 @@
 %09%09%09%09
-return students%5Bi+1%5D
+j = i+1;%0D%0A%09%09%09%09break
 ;%0D%0A%09
@@ -3605,25 +3605,52 @@
 xists%22);%0D%0A%09%09
-%09
+else%0D%0A%09%09%09return students%5Bj%5D;
 %0D%0A%09%09%09%0D%0A%09%09%7D%0D%0A

Update StudentGroup.java