⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tools.java

📁 此文件是关于手机游戏开发的理论
💻 JAVA
字号:
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Graphics;

/**
 * A bunch of static tools.
 * @author Martin J. Wells
 */
public final class Tools
{
   /**
    * Commonly used so we precalc it.
    */
   public static final int GRAPHICS_TOP_LEFT = Graphics.LEFT | Graphics.TOP;

   /**
    * Take an array of existing objects and expand it's size by a given number
    * of elements.
    * @param oldArray The array to expand.
    * @param expandBy The number of elements to expand the array by.
    * @return A new array (which is a copy of the original with space for more
    * elements.
    */
   public final static int[] expandArray(int[] oldArray, int expandBy)
   {
      int[] newArray = new int[oldArray.length + expandBy];
      System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
      return newArray;
   }

   /**
    * Take a 2D array of existing objects and expand it's size by a given number
    * of elements.
    * @param oldArray The array to expand.
    * @param expandBy The number of elements to expand the array by.
    * @return A new array (which is a copy of the original with space for more
    * elements.
    */
   public final static Image[][] expandArray(Image[][] oldArray, int expandBy)
   {
      Image[][] newArray = new Image[oldArray.length + expandBy][];
      System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
      return newArray;
   }

}


















⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -