src/jpm/dg/RetrievingActivity.java
/**
	 * Retrieves an image from a Bitmap.
	 * @param pixelData The bytes of the Bitmap.
	 * @return The resultant secret image (if any).
	 */
Retrieves an image from a Bitmap.
@param pixelData The bytes of the Bitmap.
@return The resultant secret image (if any).
Retrieves an image from a Bitmap . @param pixelData The bytes of the Bitmap . @return The resultant secret image ( if any ) .
public Bitmap decodeImage(byte[] pixelData) {
		Vector<Byte> v = new Vector<Byte>();
		decodingTask.updateProgress("Checking pixels...");
		try {
			int shiftIndex = 4;
			byte tmp = 0x00;
			for (int i = 0; i < pixelData.length && !decodingTask.isCancelled(); i++) {
				tmp = (byte) (tmp | ((pixelData[i] << SHIFT_VALUES[shiftIndex
						% SHIFT_VALUES.length]) & AND_BYTES[shiftIndex++
						% SHIFT_VALUES.length]));
				if (shiftIndex % SHIFT_VALUES.length == 0) {
					v.addElement(new Byte(tmp));
					tmp = 0x00;
				}
			}
			pixelData = null;
			System.gc();
			byte[] raw = new byte[v.size()];
			for (int i = 0; i < raw.length; i++) {
				raw[i] = v.get(i).byteValue();
			}
			v = null;
			System.gc();
			int[] values = Util.byteArrayToIntArray(raw);
			raw = null;
			System.gc();
			int width = values[0];
			int height = values[1];
			if (width <= 0 || height <= 0 || decodingTask.isCancelled()) {
				values = null;
				return null;
			}
			decodingTask.updateProgress("Reassembling image...");
			Bitmap encodedBitmap = Bitmap.createBitmap(width, height,
					Config.ARGB_8888);
			return Util.createBitmap(2, width, height, encodedBitmap, values);
		} catch (Exception e) {
			e.printStackTrace();
			v = null;
			pixelData = null;
			System.gc();
			return null;
		} catch (Throwable t) {
			t.printStackTrace();
			v = null;
			pixelData = null;
			System.gc();
			return null;
		}
	}
public Bitmap decodeImage ( byte [ ] pixelData ) { Vector < Byte > v = new Vector < Byte > ( ) ; decodingTask . updateProgress ( "Checking pixels..." ) ; try { int shiftIndex = 4 ; byte tmp = 0x00 ; for ( int i = 0 ; i < pixelData . length && ! decodingTask . isCancelled ( ) ; i ++ ) { tmp = ( byte ) ( tmp | ( ( pixelData [ i ] << SHIFT_VALUES [ shiftIndex % SHIFT_VALUES . length ] ) & AND_BYTES [ shiftIndex ++ % SHIFT_VALUES . length ] ) ) ; if ( shiftIndex % SHIFT_VALUES . length == 0 ) { v . addElement ( new Byte ( tmp ) ) ; tmp = 0x00 ; } } pixelData = null ; System . gc ( ) ; byte [ ] raw = new byte [ v . size ( ) ] ; for ( int i = 0 ; i < raw . length ; i ++ ) { raw [ i ] = v . get ( i ) . byteValue ( ) ; } v = null ; System . gc ( ) ; int [ ] values = Util . byteArrayToIntArray ( raw ) ; raw = null ; System . gc ( ) ; int width = values [ 0 ] ; int height = values [ 1 ] ; if ( width <= 0 || height <= 0 || decodingTask . isCancelled ( ) ) { values = null ; return null ; } decodingTask . updateProgress ( "Reassembling image..." ) ; Bitmap encodedBitmap = Bitmap . createBitmap ( width , height , Config . ARGB_8888 ) ; return Util . createBitmap ( 2 , width , height , encodedBitmap , values ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; v = null ; pixelData = null ; System . gc ( ) ; return null ; } catch ( Throwable t ) { t . printStackTrace ( ) ; v = null ; pixelData = null ; System . gc ( ) ; return null ; } }
Retrieves an image from a Bitmap.
Retrieves an image from a Bitmap .