Results 1 to 3 of 3
  1. #1
    locke19 is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default Converting arrays

    Hey everyone,

    I am writing a program dealing with digital image processing and I need to convert a one dimensional array into a two dimensional array. I am missing a part and need help. I can post the code if it helps

  2. #2
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    5

    Default

    So imagine you have a 100 size 1d array to turn into a 10x10 2d array.
    Java Code:
    int ROWS = 10
    for(int i=0; i<ROWS; i++)
    {
         for(int j=0; j<array.length/ROWS; j++)
         {
               2d_array[i][j] = 1d_array[ROWS*i+j]
         }
    }

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You need to define the rules you are using to do the conversion otherwise the question does not make sense.

Similar Threads

  1. Is it OK to do this... (converting int to string)
    By Psyclone in forum New To Java
    Replies: 1
    Last Post: 02-16-2010, 06:51 PM
  2. Converting a char to an int
    By michail in forum New To Java
    Replies: 10
    Last Post: 01-06-2010, 10:09 PM
  3. 2 converting errors
    By Juicer in forum New To Java
    Replies: 10
    Last Post: 03-06-2009, 03:58 PM
  4. Converting asp files to jsp
    By vrk in forum Advanced Java
    Replies: 5
    Last Post: 02-11-2009, 10:44 AM
  5. Converting URL to URI
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 11:15 AM

Tags for this Thread

Posting Permissions

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