Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help on java assignment.

 
Troy Johnson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I am new to the java programming language. I am looking for some assistance on the following java problem. I am having some trouble figuring it out. Here it is:
1.Takes an array of integers as a parameter.
2.Creates a new integer arrays containing the reversal of the parameter array.
3.Return this new array.
Can anyone offer any insight? Thanks.
 
Uma Balu
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,

1. Takes an array of integers as a parameter.

Create a class. Declare a method which accepts an int array.

2. Creates a new integer arrays containing the reversal of the parameter array.

Inside the method, declare another int array of the same length. Traverse through the first array from the last index , take that value and assign it to the newly created array from the first index. Use two counters, one to count from back and one from front.

3. Return this new array.

Return the newly created array's reference.
Hope this helps you,
Uma...
 
Billy Tsai
Ranch Hand
Posts: 1304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
figure it out yourself
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Troy --
Welcome to JavaRanch! Uma's answer sounds like it should be helpful.
Billy --
Be nice!
 
Troy Johnson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone for all of your assistance. I was able to figure out the problem with your help. Thanks again. It is greatly appreciated.
Troy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic