1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. J2ME數(shù)組的復(fù)制及連接操作方法

        時(shí)間:2023-03-16 19:07:41 SUN認(rèn)證 我要投稿
        • 相關(guān)推薦

        關(guān)于J2ME數(shù)組的復(fù)制及連接操作方法

          public class Arrays {

          /**

          * 構(gòu)造函數(shù)私有,這樣可以保證只能通過:類名.靜態(tài)方法 或 類名.靜態(tài)方法 來訪問內(nèi)部數(shù)據(jù),

          * 而不可以通過創(chuàng)建本類的對象來進(jìn)行訪問

          */

          private Arrays() {

          }

          /**

          * 復(fù)制一個(gè)跟源byte數(shù)組一樣的byte數(shù)組

          * @param rSource 源byte數(shù)組

          * @return 跟源byte[]數(shù)組一樣的byte[]數(shù)組

          */

          static public byte[] copy(byte[] rSource) {

          byte[] aResult = new byte[rSource.length];

          System.arraycopy(rSource, 0, aResult, 0, aResult.length);

          return aResult;

          }

          /**

          * 復(fù)制一個(gè)跟源int數(shù)組一樣的int數(shù)組

          * @param rSource 源int數(shù)組

          * @return 跟源int數(shù)組一樣的int數(shù)組

          */

          static public int[] copy(int[] rSource) {

          int[] aResult = new int[rSource.length];

          System.arraycopy(rSource, 0, aResult, 0, aResult.length);

          return aResult;

          }

          /**

          * 比較兩個(gè)byte數(shù)組的內(nèi)容及長度是否相等.

          * @param a1 第一個(gè)byte數(shù)組

          * @param a2 第二個(gè)byte數(shù)組

          * @return 相等的話返回true,否則返回false

          */

          static public boolean equals(byte[] a1, byte[] a2) {

          if ( (a1 == null) || (a2 == null)) {

          return a1 == a2;

          }

          int nLength = a1.length;

          if (nLength != a2.length) {

          return false;

          }

          for (int i = 0; i < nLength; i++) {

          if (a1[i] != a2[i]) {

          return false;

          }

          }

          return true;

          }

          /**

          * 比較兩個(gè)int數(shù)組的內(nèi)容及長度是否相等.

          * @param a1 第一個(gè)int數(shù)組

          * @param a2 第二個(gè)int數(shù)組

          * @return 相等的話返回true,否則返回false

          */

          static public boolean equals(int[] a1, int[] a2) {

          if ( (a1 == null) || (a2 == null)) {

          return a1 == a2;

          }

          int nLength = a1.length;

          if (nLength != a2.length) {

          return false;

          }

          for (int i = 0; i < nLength; i++) {

          if (a1[i] != a2[i]) {

          return false;

          }

          }

          return true;

          }

          /**

          * 連接兩個(gè)byte數(shù)組,之后返回一個(gè)新的連接好的byte數(shù)組

          * @param a1

          * @param a2

          * @return 一個(gè)新的連接好的byte數(shù)組

          */

          static public byte[] join(byte[] a1, byte[] a2) {

          byte[] result = new byte[a1.length + a2.length];

          System.arraycopy(a1, 0, result, 0, a1.length);

          System.arraycopy(a2, 0, result, a1.length, a2.length);

          return result;

          }

          /**

          * 連接兩個(gè)int數(shù)組,之后返回一個(gè)新的連接好的int數(shù)組

          * @param a1

          * @param a2

          * @return 一個(gè)新的連接好的int數(shù)組

          */

          static public int[] join(int[] a1, int[] a2) {

          int[] result = new int[a1.length + a2.length];

          System.arraycopy(a1, 0, result, 0, a1.length);

          System.arraycopy(a2, 0, result, a1.length, a2.length);

          return result;

          }

          }

        【J2ME數(shù)組的復(fù)制及連接操作方法】相關(guān)文章:

        2016年java數(shù)組操作方法大全03-30

        javascript創(chuàng)建數(shù)組之聯(lián)合數(shù)組的使用方法06-23

        JavaScript數(shù)組常用方法介紹03-25

        php數(shù)組函數(shù)序列之a(chǎn)rray-combine() - 數(shù)組合并函數(shù)的代碼03-31

        NIIT認(rèn)證J2ME考試真題03-07

        NIIT認(rèn)證J2ME考試真題「最新」03-07

        如何獲取PHP數(shù)組的鍵與值呢03-31

        J2ME在移動(dòng)設(shè)備上實(shí)現(xiàn)動(dòng)畫程序方法01-22

        挖掘機(jī)的操作方法03-08

        擋位的正確操作方法10-21

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>