Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to implement the following methods for a project getArrayString public static java.lang.StringgetArrayString( int [] array , char separator) Return a string where each
- I need to implement the following methods for a project
- getArrayString
public staticjava.lang.StringgetArrayString(int[]array, charseparator)
- Return a string where each array entry (except the last one) is followed by the specified separator. An empty string will be return if the array has no elements.
- Parameters:
- array-
- separator-
- Returns:
- string
- Throws:
- java.lang.IllegalArgumentException- When a null array parameter is provided
- getInstances
public staticintgetInstances(int[]array, intlowerLimit, intupperLimit)
- Returns the number of values that are in the range defined by lowerLimit (inclusive) and upperLimit (inclusive).
- Parameters:
- array-
- lowerLimit-
- upperLimit-
- Returns:
- number of values in range
- Throws:
- java.lang.IllegalArgumentException- When a null array parameter is provided
- filter
public staticint[]filter(int[]array, intlowerLimit, intupperLimit)
- Returns a new array with values in array that exists in the range defined by lowerLimit (inclusive) and upperLimit (inclusive).
- Parameters:
- array-
- lowerLimit-
- upperLimit-
- Returns:
- array with values in range
- Throws:
- java.lang.IllegalArgumentException- When a null array parameter is provided
- java.lang.IllegalArgumentException- When lowerLimit is greater than upperLimit
- rotate
public staticvoidrotate(int[]array, booleanleftRotation, intpositions)
- Rotates the provided array left if leftRotation is true; right otherwise. The number of positions to rotate is determined by positions. For example, rotating the array 10, 20, 7, 8 two positions to the left will update the array to 7, 8, 10, 20. Only arrays with 2 or more elements will be rotated. Hint: adding private methods that rotate an array one position to the left and one position to the right can help.
- Parameters:
- array-
- leftRotation-
- positions-
- Throws:
- java.lang.IllegalArgumentException- When a null array parameter is provided
- getArrayStringsLongerThan
public staticjava.lang.StringBuffer[]getArrayStringsLongerThan(java.lang.StringBuffer[]array, intlength)
- Returns a StringBuffer array with COPIES of StringBuffer objects in the array parameter that have a length greater than the length parameter. If no strings are found an empty array will be returned.
- Parameters:
- array-
- length-
- Returns:
- Throws:
- java.lang.IllegalArgumentException- When a null array parameter is provided
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started