I made a class for a tilemap that I want to get the amount of memory it allocates of.
The class looks like this:
import java.awt.*;
public class Tile {
protected Image tileImage;
protected int xposition, yposition;
public Tile(Image tile, int x, int y){
tileImage = tile;
xposition = x;
yposition = y;
}
public Image getImage(){
return tileImage;
}
public int getImageWidth(){
return tileImage.getWidth(null);
}
public int getImageHeight(){
return tileImage.getHeight(null);
}
}
How do I do this?
I need to create a very large 2D array so I need to know how much each reference of this class takes up.