Array Get Values > First

Write a method that will return an array with all values from the given list that are greater than the first value in the given array.

Return an empty array [] if the give array is empty or if the given array contains no values greater than the first value.

The code should work regardless of the parameter passed in.
hey232 232Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
Hi and welcome to Experts Exchange.

Note that this isn't a site where someone will just do your work for you. We are happy to help and assist you to come to a solution yourself.

So are you able to provide us with whatever you have attempted so far, any code that you already have, any errors that you may be getting or any specific questions about something that you are not sure of? This will help us to guide you in the direction that you need.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Here's something you can play around with to help get you started maybe. It doesn't use the first number in the given array, but one you enter instead.

import java.util.*;

class ArrayGet{

static int[] iA = new int[1000];
static int[] demoArray;
static int number;

public static void main(String[] args){

    for(int i=0;i<1000;i++){iA[i]=Integer.valueOf(i);}

    System.out.println("Input a number between 0 and 999");
    Scanner scanner = new Scanner(;

    number = scanner.nextInt();

    if(Arrays.binarySearch(iA,number+1)>-1){demoArray = sendBack(Arrays.copyOfRange(iA,number+1,iA.length));}
    else{demoArray = sendBack(new int[1000]);}

    for(int ii : demoArray){System.out.println(ii);}


    static int[] sendBack(int[] iArr){return iArr ; }


Open in new window

awking00Information Technology SpecialistCommented:
Is the parameter passed in (i.e. the "given list") itself an array or something else?
Closed. No OP feedback.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.