<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FCollections_Data_Structure%2FArray_SubArray</id>
		<title>Java/Collections Data Structure/Array SubArray - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FCollections_Data_Structure%2FArray_SubArray"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Collections_Data_Structure/Array_SubArray&amp;action=history"/>
		<updated>2026-04-08T16:51:29Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Collections_Data_Structure/Array_SubArray&amp;diff=9161&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Collections_Data_Structure/Array_SubArray&amp;diff=9161&amp;oldid=prev"/>
				<updated>2010-06-01T07:27:06Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 07:27, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Collections_Data_Structure/Array_SubArray&amp;diff=9160&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Collections_Data_Structure/Array_SubArray&amp;diff=9160&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:50Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Copies bytes from the source byte array to the destination array ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**********************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * Copyright (c) 2003, 2004 The Regents of the University of Michigan, Trustees of Indiana University,&lt;br /&gt;
 *                  Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Educational Community License Version 1.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 * By obtaining, using and/or copying this Original Work, you agree that you have read,&lt;br /&gt;
 * understand, and will comply with the terms and conditions of the Educational Community License.&lt;br /&gt;
 * You may obtain a copy of the License at:&lt;br /&gt;
 *&lt;br /&gt;
 *      http://cvs.sakaiproject.org/licenses/license_1_0.html&lt;br /&gt;
 *&lt;br /&gt;
 * THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,&lt;br /&gt;
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE&lt;br /&gt;
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,&lt;br /&gt;
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING&lt;br /&gt;
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.&lt;br /&gt;
 *&lt;br /&gt;
 **********************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Byte utilities&lt;br /&gt;
 */&lt;br /&gt;
public class ByteUtils {&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Copies bytes from the source byte array to the destination array&lt;br /&gt;
   * &lt;br /&gt;
   * @param source&lt;br /&gt;
   *          The source array&lt;br /&gt;
   * @param srcBegin&lt;br /&gt;
   *          Index of the first source byte to copy&lt;br /&gt;
   * @param srcEnd&lt;br /&gt;
   *          Index after the last source byte to copy&lt;br /&gt;
   * @param destination&lt;br /&gt;
   *          The destination array&lt;br /&gt;
   * @param dstBegin&lt;br /&gt;
   *          The starting offset in the destination array&lt;br /&gt;
   */&lt;br /&gt;
  public static void getBytes(byte[] source, int srcBegin, int srcEnd, byte[] destination,&lt;br /&gt;
      int dstBegin) {&lt;br /&gt;
    System.arraycopy(source, srcBegin, destination, dstBegin, srcEnd - srcBegin);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Return a new byte array containing a sub-portion of the source array&lt;br /&gt;
   * &lt;br /&gt;
   * @param srcBegin&lt;br /&gt;
   *          The beginning index (inclusive)&lt;br /&gt;
   * @param srcEnd&lt;br /&gt;
   *          The ending index (exclusive)&lt;br /&gt;
   * @return The new, populated byte array&lt;br /&gt;
   */&lt;br /&gt;
  public static byte[] subbytes(byte[] source, int srcBegin, int srcEnd) {&lt;br /&gt;
    byte destination[];&lt;br /&gt;
    destination = new byte[srcEnd - srcBegin];&lt;br /&gt;
    getBytes(source, srcBegin, srcEnd, destination, 0);&lt;br /&gt;
    return destination;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Return a new byte array containing a sub-portion of the source array&lt;br /&gt;
   * &lt;br /&gt;
   * @param srcBegin&lt;br /&gt;
   *          The beginning index (inclusive)&lt;br /&gt;
   * @return The new, populated byte array&lt;br /&gt;
   */&lt;br /&gt;
  public static byte[] subbytes(byte[] source, int srcBegin) {&lt;br /&gt;
    return subbytes(source, srcBegin, source.length);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exclude 2 arrays of ints ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Project: OpenSubsystems&lt;br /&gt;
 * &lt;br /&gt;
 * $Id: ArrayUtils.java,v 1.9 2007/01/23 06:00:30 bastafidli Exp $&lt;br /&gt;
 * &lt;br /&gt;
 * This program is free software; you can redistribute it and/or modify&lt;br /&gt;
 * it under the terms of the GNU General Public License as published by&lt;br /&gt;
 * the Free Software Foundation; version 2 of the License. &lt;br /&gt;
 * &lt;br /&gt;
 * This program is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 * GNU General Public License for more details.&lt;br /&gt;
 * &lt;br /&gt;
 * You should have received a copy of the GNU General Public License&lt;br /&gt;
 * along with this program; if not, write to the Free Software&lt;br /&gt;
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Collection of useful utilities to work with arrays. &lt;br /&gt;
 * &lt;br /&gt;
 * @version $Id: ArrayUtils.java,v 1.9 2007/01/23 06:00:30 bastafidli Exp $&lt;br /&gt;
 * @author Peter Satury&lt;br /&gt;
 * @code.reviewer Miro Halas&lt;br /&gt;
 * @code.reviewed 1.5 2005/07/29 07:36:24 bastafidli&lt;br /&gt;
 */&lt;br /&gt;
public final class ArrayUtils&lt;br /&gt;
{&lt;br /&gt;
   /** &lt;br /&gt;
    * Private constructor since this class cannot be instantiated&lt;br /&gt;
    */&lt;br /&gt;
   private ArrayUtils(&lt;br /&gt;
   )&lt;br /&gt;
   {&lt;br /&gt;
      // Do nothing&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Public methods ///////////////////////////////////////////////////////////&lt;br /&gt;
   /**&lt;br /&gt;
    * Method to exclude 2 arrays of ints so that the result contains all elements&lt;br /&gt;
    * from the first array, which are not in the second array.&lt;br /&gt;
    *  &lt;br /&gt;
    * @param arrBase - base array to exclude from &lt;br /&gt;
    * @param arrExclude - array to exclude from the first one&lt;br /&gt;
    * @return int[] - array which contains all elements from the first array &lt;br /&gt;
    *                 which are not in the second array or null&lt;br /&gt;
    */&lt;br /&gt;
   public static int[] exclude(&lt;br /&gt;
      int[] arrBase, &lt;br /&gt;
      int[] arrExclude&lt;br /&gt;
   )&lt;br /&gt;
   {&lt;br /&gt;
      int[] arrReturn = null;&lt;br /&gt;
      if ((arrBase != null) &amp;amp;&amp;amp; (arrBase.length &amp;gt; 0) &amp;amp;&amp;amp; (arrExclude != null)&lt;br /&gt;
         &amp;amp;&amp;amp; (arrExclude.length &amp;gt; 0))&lt;br /&gt;
      {&lt;br /&gt;
         int[] arrHelp;&lt;br /&gt;
         int   iCount1;&lt;br /&gt;
         int   iHelp;&lt;br /&gt;
         int   iLength = 0;&lt;br /&gt;
         &lt;br /&gt;
         arrHelp = new int[arrBase.length];&lt;br /&gt;
         for (iCount1 = 0; iCount1 &amp;lt; arrBase.length; iCount1++)&lt;br /&gt;
         {&lt;br /&gt;
            iHelp = arrBase[iCount1];&lt;br /&gt;
            if (ArrayUtils.contains(arrExclude, iHelp) == -1)&lt;br /&gt;
            {&lt;br /&gt;
               // If the element is not part of the second array then it should&lt;br /&gt;
               // be included in the result&lt;br /&gt;
               arrHelp[iLength++] = iHelp;&lt;br /&gt;
            }&lt;br /&gt;
         }&lt;br /&gt;
         &lt;br /&gt;
         // Shrink the array&lt;br /&gt;
         // TODO: Performance: Replace this with System.arraycopy&lt;br /&gt;
         arrReturn = new int[iLength];&lt;br /&gt;
         for (int iCount = 0; iCount &amp;lt; iLength; iCount++)&lt;br /&gt;
         {&lt;br /&gt;
            arrReturn[iCount] = arrHelp[iCount];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
         arrReturn = arrBase;&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      return arrReturn;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   /**&lt;br /&gt;
    * Test if specified array contains given element and if it does, find &lt;br /&gt;
    * its position.&lt;br /&gt;
    * &lt;br /&gt;
    * @param source - array to search, can be null&lt;br /&gt;
    * @param iTarget - element to find&lt;br /&gt;
    * @return int - -1 if it doesn&amp;quot;t exist there otherwise its position&lt;br /&gt;
    */&lt;br /&gt;
   public static int contains(&lt;br /&gt;
      int[] source,&lt;br /&gt;
      int   iTarget&lt;br /&gt;
   )&lt;br /&gt;
   {&lt;br /&gt;
      int iReturn = -1;&lt;br /&gt;
      &lt;br /&gt;
      if ((source != null) &amp;amp;&amp;amp; (source.length &amp;gt; 0))&lt;br /&gt;
      {   &lt;br /&gt;
         int iIndex;&lt;br /&gt;
         &lt;br /&gt;
         for (iIndex = 0; iIndex &amp;lt; source.length; iIndex++)&lt;br /&gt;
         {&lt;br /&gt;
            if (source[iIndex] == iTarget)&lt;br /&gt;
            {&lt;br /&gt;
               iReturn = iIndex;&lt;br /&gt;
               break;&lt;br /&gt;
            }&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      return iReturn;&lt;br /&gt;
   }&lt;br /&gt;
   /**&lt;br /&gt;
    * Sum all elements in the array.&lt;br /&gt;
    * &lt;br /&gt;
    * @param source - array to sum elements of&lt;br /&gt;
    * @return long - sum of the elements in the array&lt;br /&gt;
    */&lt;br /&gt;
   public static long sum(&lt;br /&gt;
      int[] source&lt;br /&gt;
   )&lt;br /&gt;
   {&lt;br /&gt;
      int iReturn = 0;&lt;br /&gt;
      &lt;br /&gt;
      if ((source != null) &amp;amp;&amp;amp; (source.length &amp;gt; 0))&lt;br /&gt;
      {   &lt;br /&gt;
         int iIndex;&lt;br /&gt;
         &lt;br /&gt;
         for (iIndex = 0; iIndex &amp;lt; source.length; iIndex++)&lt;br /&gt;
         {&lt;br /&gt;
            iReturn += source[iIndex];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      return iReturn;&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gets the subarray from array that starts at offset. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright Aduna (http://www.aduna-software.ru/) (c) 1997-2006.&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Aduna BSD-style license.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
public class Utils {&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Gets the subarray from &amp;lt;tt&amp;gt;array&amp;lt;/tt&amp;gt; that starts at &amp;lt;tt&amp;gt;offset&amp;lt;/tt&amp;gt;.&lt;br /&gt;
   */&lt;br /&gt;
  public static byte[] get(byte[] array, int offset) {&lt;br /&gt;
    return get(array, offset, array.length - offset);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Gets the subarray of length &amp;lt;tt&amp;gt;length&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;array&amp;lt;/tt&amp;gt;&lt;br /&gt;
   * that starts at &amp;lt;tt&amp;gt;offset&amp;lt;/tt&amp;gt;.&lt;br /&gt;
   */&lt;br /&gt;
  public static byte[] get(byte[] array, int offset, int length) {&lt;br /&gt;
    byte[] result = new byte[length];&lt;br /&gt;
    System.arraycopy(array, offset, result, 0, length);&lt;br /&gt;
    return result;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gets the subarray of length length from array that starts at offset. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright Aduna (http://www.aduna-software.ru/) (c) 1997-2006.&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Aduna BSD-style license.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
public class Utils {&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Gets the subarray of length &amp;lt;tt&amp;gt;length&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;array&amp;lt;/tt&amp;gt;&lt;br /&gt;
   * that starts at &amp;lt;tt&amp;gt;offset&amp;lt;/tt&amp;gt;.&lt;br /&gt;
   */&lt;br /&gt;
  public static byte[] get(byte[] array, int offset, int length) {&lt;br /&gt;
    byte[] result = new byte[length];&lt;br /&gt;
    System.arraycopy(array, offset, result, 0, length);&lt;br /&gt;
    return result;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Puts the entire source array in the target array at offset offset. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright Aduna (http://www.aduna-software.ru/) (c) 1997-2006.&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Aduna BSD-style license.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
public class Utils {&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Puts the entire &amp;lt;tt&amp;gt;source&amp;lt;/tt&amp;gt; array in the &amp;lt;tt&amp;gt;target&amp;lt;/tt&amp;gt;&lt;br /&gt;
   * array at offset &amp;lt;tt&amp;gt;offset&amp;lt;/tt&amp;gt;.&lt;br /&gt;
   */&lt;br /&gt;
  public static void put(byte[] source, byte[] target, int offset) {&lt;br /&gt;
    System.arraycopy(source, 0, target, offset, source.length);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>