Here you can find the source of toIntArray(byte[] input)
Parameter | Description |
---|---|
input | - the byte array |
public static int[] toIntArray(byte[] input)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 JCrypTool Team and Contributors * //from ww w .ja v a2s .co m * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse * Public License v1.0 which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ public class Main { /** * Rewrite a byte array as an int array (the array can be padded with zeros) * * @param input - the byte array * @return int array */ public static int[] toIntArray(byte[] input) { int[] result = new int[(input.length + 3) >>> 2]; int index, shiftpos; for (int i = 0; i < input.length; i++) { index = i >>> 2; shiftpos = i % 4; result[index] ^= (input[i] & 0xff) << (8 * shiftpos); } return result; } }