troubleshooting Question

Java array sort

Avatar of Boncz Szilard
Boncz Szilard asked on
JavaJava EE
10 Comments1 Solution382 ViewsLast Modified:
Here but not working correct me pls
Thank you!!!

public static void main(String[] args) {

    int array1[]= {12, 23, -22, 0, 43, 545, -4, -55, 43, 12, 0, -999, -87};

    System.out.println("Array 1 :");

    Arrays.sort(array1);

    for (int positive: array1) {

        if (positive >= -1)
            System.out.println("Positive numbers :" + positive+ "\t");
        }
        System.out.println();
        System.out.println("Array 2 :");

        for (int negative: array1) {
            if (negative >= -1) {

            }else{ System.out.println("Negative numbers :" +negative);
            }

        }
        System.out.println();

        for (int i = 0; i < array1.length -1; i++) {
             if (array1[/i + 1 ] == array1) {
                 System.out.println("Duplicate element found :" + array1);
                 i = i + 1;

             }    
}
}
}




And a ineed this aoutputs


Starter array: 12 23 -22 0 43 545 -4 -55 43 12 0 -999 -87

Positive array: 12 23 0 43 545 43 12 0

Negative array: -22 -4 -55 -999 -87

Duplicate array :12 0 43

Thx!!!
ASKER CERTIFIED SOLUTION
James Bilous
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros