1. Member Join Date
Oct 2012
Posts
2
Rep Power
0

## Java Assignment help?

hi so im super stuck on this part of my assignment, if anyone could help me get started id greatly appreciate it :)

Create a method that would return a 2D sub-array of a 2D array of integers. Given a location (i,j) and
two odd numbers dx and dy, return the sub-array centered at (i,j) extending from i-dx/2 to i+dx/2 and
from j-dy/2 to j+dy/2. Note: the previous divisions are integer divisions returning an integer; for
dx=dy=5, dx/2=dy/2=2.
public static int [][] snip(int [][] a,int i, int j, int dx, int dy)
If i, j, i-dx, j-dy, i+dx, j+dy are out of bounds return null. For dx=3, dy=3 the indices should be:

(there is a matrix posted here but i cant seem to copy and paste, but the values in order starting from the top left going right are:

((i-dx/2),(j-dy/2)) (i,(j-dy/2)) ((i+dx/2),(j-dy/2))
((i-dx/2),j) (i,j) ((i+dx/2),j)
((i-dx/2),(j+dy/2)) (i,(j+dy/2)) ((i+dx/2),(j+dy/2))

does that make any sense??
THANK YOU!  Reply With Quote

2. ## Re: Java Assignment help?

You may wish to reply to help given in your previous post on this forum as that can motivate folks to help you further. We like to know that are efforts aren't for naught, that you actually read and digest what we have posted.  Reply With Quote

#### Posting Permissions

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