Results 1 to 3 of 3
  1. #1
    jaxber is offline Member
    Join Date
    Apr 2011
    Posts
    3
    Rep Power
    0

    Default question about 2d arrays

    I am a new one of java;

    I have a question about 2d array which is that

    IF a 2d array is of size[3][3]; like a 3*3 image;

    how to design a program to read integers into an integer array
    like
    1 2 3
    4 5 6
    7 8 9


    if so, how to copy the array into a new array such that the image is like

    3 2 1
    6 5 4
    9 8 7

    or

    987
    654
    321;

    I am very confusing about that ,hope to get ideas from here,thank you;

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Cool

    Have you actually tried anything for this?

    See if this can help : Two-Dimensional Arrays

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,556
    Rep Power
    25

    Default

    Take a piece of paper and write down the index for the source and the index for the target. Do it for all the numbers in the array.
    Look at the relationship between each pair of numbers to see how to write a loop to do the copy.

Similar Threads

  1. Java question - arrays
    By encyclopedia in forum New To Java
    Replies: 8
    Last Post: 09-15-2010, 12:48 PM
  2. Java arrays (not sure if this question is advanced)
    By aga010607 in forum Advanced Java
    Replies: 1
    Last Post: 11-24-2009, 01:43 PM
  3. Question about 2D arrays
    By fanle in forum New To Java
    Replies: 7
    Last Post: 07-22-2009, 05:52 PM
  4. question about arrays
    By broganm1 in forum New To Java
    Replies: 3
    Last Post: 02-13-2008, 02:29 AM
  5. Question about arrays
    By nhlfan in forum New To Java
    Replies: 4
    Last Post: 11-15-2007, 11:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •