gt: 		long[] data = new long[value.length];
context: /*
   * Copyright (C) 2012 The Android Open Source Project
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package com.ai.exif;
  
  import java.nio.charset.Charset;
  import java.text.SimpleDateFormat;
  import java.util.Arrays;
  import java.util.Date;
  
  /**
   * This class stores information of an EXIF tag. For more information about
   * defined EXIF tags, please read the Jeita EXIF 2.2 standard. Tags should be
   * instantiated using {@link ExifInterface#buildTag}.
   * <p>
   * Copy from and com.android.camera.exif
   * 
   * @author leo
   * @see ExifInterface
   */
  public class ExifTag {
  	/**
  	 * The BYTE type in the EXIF standard. An 8-bit unsigned integer.
  	 */
  	public static final short TYPE_UNSIGNED_BYTE = 1;
  	/**
  	 * The ASCII type in the EXIF standard. An 8-bit byte containing one 7-bit
  	 * ASCII code. The final byte is terminated with NULL.
  	 */
  	public static final short TYPE_ASCII = 2;
  	/**
  	 * The SHORT type in the EXIF standard. A 16-bit (2-byte) unsigned integer
  	 */
  	public static final short TYPE_UNSIGNED_SHORT = 3;
  	/**
  	 * The LONG type in the EXIF standard. A 32-bit (4-byte) unsigned integer
  	 */
  	public static final short TYPE_UNSIGNED_LONG = 4;
  	/**
  	 * The RATIONAL type of EXIF standard. It consists of two LONGs. The first
  	 * one is the numerator and the second one expresses the denominator.
  	 */
  	public static final short TYPE_UNSIGNED_RATIONAL = 5;
  	/**
  	 * The UNDEFINED type in the EXIF standard. An 8-bit byte that can take any
  	 * value depending on the field definition.
  	 */
  	public static final short TYPE_UNDEFINED = 7;
  	/**
  	 * The SLONG type in the EXIF standard. A 32-bit (4-byte) signed integer
  	 * (2's complement notation).
  	 */
  	public static final short TYPE_LONG = 9;
  	/**
  	 * The SRATIONAL type of EXIF standard. It consists of two SLONGs. The first
  	 * one is the numerator and the second one is the denominator.
  	 */
  	public static final short TYPE_RATIONAL = 10;
  
  	private static Charset US_ASCII = Charset.forName("US-ASCII");
  	private static final int TYPE_TO_SIZE_MAP[] = new int[11];
  	private static final int UNSIGNED_SHORT_MAX = 65535;
  	private static final long UNSIGNED_LONG_MAX = 4294967295L;
  	private static final long LONG_MAX = Integer.MAX_VALUE;
  	private static final long LONG_MIN = Integer.MIN_VALUE;
  
  	static {
  		TYPE_TO_SIZE_MAP[TYPE_UNSIGNED_BYTE] = 1;
  		TYPE_TO_SIZE_MAP[TYPE_ASCII] = 1;
  		TYPE_TO_SIZE_MAP[TYPE_UNSIGNED_SHORT] = 2;
  		TYPE_TO_SIZE_MAP[TYPE_UNSIGNED_LONG] = 4;
  		TYPE_TO_SIZE_MAP[TYPE_UNSIGNED_RATIONAL] = 8;
  		TYPE_TO_SIZE_MAP[TYPE_UNDEFINED] = 1;
  		TYPE_TO_SIZE_MAP[TYPE_LONG] = 4;
  		TYPE_TO_SIZE_MAP[TYPE_RATIONAL] = 8;
  	}
  
  	static final int SIZE_UNDEFINED = 0;
  
  	// Exif TagId
  	private final short mTagId;
  	// Exif Tag Type
  	private final short mDataType;
  	// If tag has defined count
  	private boolean mHasDefinedDefaultComponentCount;
  	// Actual data count in tag (should be number of elements in value array)
  	private int mComponentCountActual;
  	// The ifd that this tag should be put in
  	private int mIfd;
  	// The value (array of elements of type Tag Type)
  	private Object mValue;
  	// Value offset in exif header.
  	private int mOffset;
  
  	private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("yyyy:MM:dd kk:mm:ss");
  
  	/**
  	 * Returns true if the given IFD is a valid IFD.
  	 */
  	public static boolean isValidIfd(int ifdId) {
  		return ifdId == IfdId.TYPE_IFD_0 || ifdId == IfdId.TYPE_IFD_1 || ifdId == IfdId.TYPE_IFD_EXIF || ifdId == IfdId.TYPE_IFD_INTEROPERABILITY
  				|| ifdId == IfdId.TYPE_IFD_GPS;
  	}
  
  	/**
  	 * Returns true if a given type is a valid tag type.
  	 */
  	public static boolean isValidType(short type) {
  		return type == TYPE_UNSIGNED_BYTE || type == TYPE_ASCII || type == TYPE_UNSIGNED_SHORT || type == TYPE_UNSIGNED_LONG || type == TYPE_UNSIGNED_RATIONAL
  				|| type == TYPE_UNDEFINED || type == TYPE_LONG || type == TYPE_RATIONAL;
  	}
  
  	// Use builtTag in ExifInterface instead of constructor.
  	ExifTag(short tagId, short type, int componentCount, int ifd, boolean hasDefinedComponentCount) {
  		mTagId = tagId;
  		mDataType = type;
  		mComponentCountActual = componentCount;
  		mHasDefinedDefaultComponentCount = hasDefinedComponentCount;
  		mIfd = ifd;
  		mValue = null;
  	}
  
  	/**
  	 * Gets the element size of the given data type in bytes.
  	 * 
  	 * @see #TYPE_ASCII
  	 * @see #TYPE_LONG
  	 * @see #TYPE_RATIONAL
  	 * @see #TYPE_UNDEFINED
  	 * @see #TYPE_UNSIGNED_BYTE
  	 * @see #TYPE_UNSIGNED_LONG
  	 * @see #TYPE_UNSIGNED_RATIONAL
  	 * @see #TYPE_UNSIGNED_SHORT
  	 */
  	public static int getElementSize(short type) {
  		return TYPE_TO_SIZE_MAP[type];
  	}
  
  	/**
  	 * Returns the ID of the IFD this tag belongs to.
  	 * 
  	 * @see IfdId#TYPE_IFD_0
  	 * @see IfdId#TYPE_IFD_1
  	 * @see IfdId#TYPE_IFD_EXIF
  	 * @see IfdId#TYPE_IFD_GPS
  	 * @see IfdId#TYPE_IFD_INTEROPERABILITY
  	 */
  	public int getIfd() {
  		return mIfd;
  	}
  
  	protected void setIfd(int ifdId) {
  		mIfd = ifdId;
  	}
  
  	/**
  	 * Gets the TID of this tag.
  	 */
  	public short getTagId() {
  		return mTagId;
  	}
  
  	/**
  	 * Gets the data type of this tag
  	 * 
  	 * @see #TYPE_ASCII
  	 * @see #TYPE_LONG
  	 * @see #TYPE_RATIONAL
  	 * @see #TYPE_UNDEFINED
  	 * @see #TYPE_UNSIGNED_BYTE
  	 * @see #TYPE_UNSIGNED_LONG
  	 * @see #TYPE_UNSIGNED_RATIONAL
  	 * @see #TYPE_UNSIGNED_SHORT
  	 */
  	public short getDataType() {
  		return mDataType;
  	}
  
  	/**
  	 * Gets the total data size in bytes of the value of this tag.
  	 */
  	public int getDataSize() {
  		return getComponentCount() * getElementSize(getDataType());
  	}
  
  	/**
  	 * Gets the component count of this tag.
  	 */
  
  	// TODO: fix integer overflows with this
  	public int getComponentCount() {
  		return mComponentCountActual;
  	}
  
  	/**
  	 * Sets the component count of this tag. Call this function before
  	 * setValue() if the length of value does not match the component count.
  	 */
  	protected void forceSetComponentCount(int count) {
  		mComponentCountActual = count;
  	}
  
  	/**
  	 * Returns true if this ExifTag contains value; otherwise, this tag will
  	 * contain an offset value that is determined when the tag is written.
  	 */
  	public boolean hasValue() {
  		return mValue != null;
  	}
  
  	/**
  	 * Sets integer values into this tag. This method should be used for tags of
  	 * type {@link #TYPE_UNSIGNED_SHORT}. This method will fail if:
  	 * <ul>
  	 * <li>The component type of this tag is not {@link #TYPE_UNSIGNED_SHORT},
  	 * {@link #TYPE_UNSIGNED_LONG}, or {@link #TYPE_LONG}.</li>
  	 * <li>The value overflows.</li>
  	 * <li>The value.length does NOT match the component count in the definition
  	 * for this tag.</li>
  	 * </ul>
  	 */
  	public boolean setValue(int[] value) {
  		if (checkBadComponentCount(value.length)) {
  			return false;
  		}
  		if (mDataType != TYPE_UNSIGNED_SHORT && mDataType != TYPE_LONG && mDataType != TYPE_UNSIGNED_LONG) {
  			return false;
  		}
  		if (mDataType == TYPE_UNSIGNED_SHORT && checkOverflowForUnsignedShort(value)) {
  			return false;
  		} else if (mDataType == TYPE_UNSIGNED_LONG && checkOverflowForUnsignedLong(value)) {
  			return false;
  		}
  
  