import java.util.Date;
import java.util.Arrays;
/**
 * 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;
	 Student[] b;
	/**
	 * 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 this.students[index];
	}

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

	@Override
	public void addFirst(Student student) {
		if (student==null) {
			throw new IllegalArgumentException("invalid data");

	
					}
		else
		{

			for(int i = students.length;i>0;i--)
				{

					students[i] =students[i-1];

				}
			students[0] = student;
			b=Arrays.copyOf(students,students.length);
			students=b;
		}
	}

	@Override
	public void addLast(Student student) {
		if (student==null) {
			throw new IllegalArgumentException("invalid data");

	
					}
		else
		{
		students[students.length]=student;
		}

	}

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

			for(int i = students.length;i>index;i--)
				{

					students[i] =students[i-1];

				}
			students[index] = student;
		
		b=Arrays.copyOf(students,students.length);
		students=b;
		}
		
	}

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

			for(int i = index; i<students.length-1; i++)
				{

					students[i] =students[i+1];

				}
			students[i+1] = null;
			b=Arrays.copyOf(students,students.length);
			students=b;
		}
	}

	@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) {
		
		int j=-1, flag=0, n = students.length;
		Student[] stu= new Student[n];
		
		if(date==null)
			throw new IllegalArgumentException("invalid arguments");
		else
		{
			
		for(int i=0; i<n; i++)
		{
			
			
		}
		
		if(j==-1)
		{
			throw new IllegalArgumentException("not found in the array");
		}
		else
			return stu;
		} 
		
	}

	@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() {
		int n;
		float max;
		
		
		return null;
		
	}

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

@@ -2589,24 +2589,28 @@
 t index) %7B%0D%0A
+%09%09%0D%0A
 %09%09if( index%3C
@@ -2615,32 +2615,37 @@
 x%3C0 %7C%7C index %3E= 
+this.
 students.length)
@@ -2745,16 +2745,21 @@
 ndex; i%3C
+this.
 students
@@ -2781,32 +2781,37 @@
 %0D%0A%09%09%09%09%7B%0D%0A%0D%0A%09%09%09%09%09
+this.
 students%5Bi%5D =stu
@@ -2799,32 +2799,37 @@
 is.students%5Bi%5D =
+this.
 students%5Bi+1%5D;%0D%0A
@@ -2832,32 +2832,37 @@
 %5D;%0D%0A%0D%0A%09%09%09%09%7D%0D%0A%09%09%09
+this.
 students%5Bi+1%5D = 
@@ -2879,32 +2879,37 @@
 b=Arrays.copyOf(
+this.
 students,student
@@ -2893,32 +2893,37 @@
 f(this.students,
+this.
 students.length)
@@ -2920,32 +2920,37 @@
 ts.length);%0D%0A%09%09%09
+this.
 students=b;%0D%0A%09%09%7D

Update StudentGroup.java