Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8510395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:41:33+00:00 2026-06-11T03:41:33+00:00

i have tried to split a ByteArray (that represents a screenShot Data) into a

  • 0

i have tried to split a ByteArray (that represents a screenShot Data) into
a 2d array so if i have for example an array of 3×3 (xy /rows columns)

it would look like this

int screenSwidth = 3;
int screenSheight = 3;
byte[] ScreenShot = new byte[] {1,2,3,4,5,6,7,8,9};

i am trying via 2 nested for loops, to split the serial data into
separated rows in a new 2dimentional array as it was shaped/formed originaly on the screen.

lets Just call the new ScreenShotRows[] as “b” just for this example

b[0][0] = 1 b[0][1] = 2 b[0][2] = 3

b[1][0] = 4 b[1][1] = 5 b[1][2] = 6

b[2][0] = 7 b[2][1] = 8 b[2][2] = 9

and the question is what is the right way to iterate through the whole array
i was trying to achieve that via this code .

     for (int HeightIter= 0; HeightIter < screenSheight; HeightIter++)
     {
           for (int WidthIter = 0; WidthIter < screenSwidth ; WidthIter++)
                {
                     ScreenShotRows[HeightIter, WidthIter] = ScreenShot[WidthIter];
                }
     }

and it loops over the first row , asigning the values :

b[0][0] = 1 b[0][1] = 2 b[0][2] = 3

b[1][0] = 1 b[0][1] = 2 b[0][2] = 3

b[2][0] = 1 b[0][1] = 2 b[0][2] = 3

this is my first attempt on this kind of multiDimetional /jagged array
with nested for loop,
and i found it very confiusing to make it work

also to get it done as fast as it could be,

cause my data is much larger than 3×3 , and method is called multiple times frequently so performance is crucial

my next move will be to have same way with the columns

elements 0,0 to 0,2 —- elements 1,0 to 1,2 —- ements 2,0 to 2,2

      147                    258                369
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:41:35+00:00Added an answer on June 11, 2026 at 3:41 am

    Replace your firsts line to:

    for (int HeightIter= 0; HeightIter < screenSheight; HeightIter++)
    

    And the line ScreenShotRows[HeightIter, WidthIter] = ScreenShot[WidthIter]; to

    ScreenShotRows[HeightIter, WidthIter] = ScreenShot[3*HeightIter+WidthIter];
    

    This should make 2d array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to split a file(suppose a mp3) into four parts.I have tried this
My ideal scenario would be to have Vim split into two windows - first
I have been attempting to split a div into two columns using CSS, but
I have a string in PHP that I would like to split. This string
I have a tab-delimited text file. I have split this into columns. Each of
I have a dynamic list that I need to lineup nicely into 2 columns
I have tried STDIN.gets.chomp.split( ) And then converted each elements in the array to
I like to convert string for example : String data = 1|apple,2|ball,3|cat; into a
I have a string that I need to split on a certain character. However,
Using php how to split the usernames,passwords,datadasename,hostname,etc into a variable. For Example: $db =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.