Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Resizing 2D Arrays

  1. #1
    Join Date
    Sep 2014
    Posts
    1
    Rep Power
    0

    Default Resizing 2D Arrays

    How do i increase the size of a 2D array from 2X2 to 4X4 where only the boundary elements are zeroes and the rest of them remain the same?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: Resizing 2D Arrays

    Quote Originally Posted by Varsha Muppalaneni View Post
    How do i increase the size of a 2D array
    You can't. In Java, arrays can't be resized.

    db
    Varsha Muppalaneni likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Resizing 2D Arrays

    Quote Originally Posted by DarrylBurke View Post
    You can't. In Java, arrays can't be resized.
    ... but you can create a new array that is bigger and copy the old array to the new array. Simple Google searches for "java array resize" will very likely lead to examples showing exactly how to do that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Resizing an Image
    By aortell24 in forum New To Java
    Replies: 6
    Last Post: 06-15-2012, 02:46 AM
  2. resizing a rectangle?
    By ludis in forum New To Java
    Replies: 9
    Last Post: 12-12-2010, 01:00 PM
  3. panel resizing
    By kumar_gemi in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 02:51 AM
  4. Image Resizing and DPi
    By Rob_ in forum Java Applets
    Replies: 4
    Last Post: 11-27-2008, 02:21 PM
  5. Image resizing
    By alley in forum Java 2D
    Replies: 2
    Last Post: 11-13-2007, 10:10 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
  •