Computer Science Homework Solutions
Problem
#60671

Arrays in java

Write the definition of a method,  isReverse , whose two parameters are arrays of integers of equal size. The method returns  true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.)

So, suppose you had two int arrays, forward and backward, each with 4 elements. Now suppose that forward had these elements: 1, 2, 3, 4 and that backward had these: values 4, 3, 2, 1.

Then if your isReverse method were invoked, passing it forward and backward, it would return true.


Please explain in detail to aid learning process


Solution Summary

Solution is a Java file ReverseArray.java which demonstrates how to check if an Array is in reverse order of another Array.

Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$3.99)
Included in Download
  • Plain text response
  • Attached file(s):
    • ReverseArray.java
    • ReverseArray.class
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Java - What does the following program do? - SomeClass.java - // Exercise 15.13 Solution: SomeClass.java public class SomeClass { public String someMethod( int array2[], int x, String output ) { if ( x < array2.length ) ...
  • Write a java syntax - 1. Write Java syntax which declares a 1D integer array myary that holds 5 values. 2. Instantiate and initialize the array from Q#1 with values: 5, 3, 5, 7,
  • Trying to figure out code for a Java program. - I need an array that holds six objects, which I will place data in. I need a method to sort the array in ascending order and I need to call the method and display the results.
  • Java Programming - 1. List three types of errors that you can encounter in a Java program, and describe what you will do to minimize the errors. 2. Create an array with 5 elements of type int in a for loop go from 0 ...
  • Demo of Java array and code that assigns values based on the membership of the array - Given: an int variable k , an int array currentMembers that has been declared and initialized, an int variable memberID that has been initialized, and an boolean variable isAMember ...
Browse