Search:

Type: Posts; User: GregBrannon

Search: Search took 0.11 seconds.

  1. Replies
    7
    Views
    1,332

    Re: nullpointerexception bug

    You just need to work through this formula to see if it is correct:

    return (sort[(sort.length / 2) - 1] + sort[(sort.length) / 2] / 2)

    So, for an even number of elements in the array, say '6',...
  2. Replies
    7
    Views
    1,332

    Re: nullpointerexception bug

    The error, "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
    at media.main(media.java:44)" points at this code:

    /* Sorting begins */
    for ( i = 1 ; i <= n-1...
  3. Replies
    7
    Views
    1,332

    Re: nullpointerexception bug

    Wait to define the a[] array until you know how many elements it should have. Something like:

    System.out.println("Enter the number of items\n");
    try {
    ...
Results 1 to 3 of 3