# Java Assignment help?

• 11-24-2012, 01:20 AM
smith999
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!
• 11-24-2012, 01:25 AM
Fubarable
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.