Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you help with java code? Write a class called ArrayHelper that contains the following methods: A static method called firstIndexOf that accepts an array

can you help with java code?

Write a class called ArrayHelper that contains the following methods: A static method called firstIndexOf that accepts an array of integers and an integer. It will return the index where the first occurrence of the integer value occurs in the integer array. Return a -1 if the value never occurs or the array is null. A static method called lastIndexOf that accepts an array of integers and an integer. It will return the index where the last occurrence of the integer value occurs in the integer array. Return a -1 if the value never occurs or the array is null. A static method called isSorted that accepts an array of real numbers (double) and returns true if the list is sorted in ascending order. A one element array is considered sorted. Return false if the array is null. A static method called isReverse that accepts two arrays of ints and returns true of one list is the reverse of the other list. Return false if either or both lists are null. A static method called whoIsBuying that accepts an arrays of strings and randomly returns one of the strings. If the array is a null return a null. Be sure all names in the array have the same chance of being chosen. A static method called longestString that accepts an array of strings and returns an array of String with two elements. The first element will be the longest String(the last occurance in the case of a tie) and the second element will be the index that it was found at(expressed as a string) . If the list is null return a null. There should be no way for these methods to blow up regardless of the parameters sent to the methods.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions