0

I am working on an assignment for my introductory Java class and have run into an error I cannot seem to figure out! I must create a static sortIntoGroups method that partitions an array without using any while loops. The method must be callable from a separate driver class. I am currently trying to test it out with a main method but for some reason it does not seem to recognize the method. Here is my code: public class ArrayHelper{

public class ArrayHelper{
public static int sortIntoGroups (int[] arrayToSort, int partitionValue){
    int i = 0;
    int j = (arrayToSort.length-1);
    do{
        for(i=0; i < partitionValue; i++ ){
        for(j = (arrayToSort.length-1); j > partitionValue; j--){
        if (i < j){
            int tempVar = arrayToSort[i];
                arrayToSort[i] = arrayToSort[j];
                arrayToSort[j] = tempVar;
        }//end if 
        }//end j for
        }// end i for 
    }while(i< j);

    return j;

}//end sortIntoGroups

public static void main (String [] args){
    int [] testArray = {1, 2, 3, 4, 5};
    int partitionVal = 4;

System.out.print(testArray.sortIntoGroups(testArray, partitionVal));

}
}   

Any ideas? Thanks!

Gabbie
  • 31
  • 1
  • 9
  • Does your code include import statements? also which line does compiler complains about? what code is in that line? – Ivan Nov 22 '16 at 19:44

1 Answers1

0

Static methods are referred by Class name. You should be calling the method as

   System.out.print(ArrayHelper.sortIntoGroups(testArray, partitionVal));

Hope that helps :)

Sai Kumar
  • 112
  • 2
  • 11