How to convert string into bits and then into int array - java
问题 How to convert string into bits(not bytes) or array of bits in Java(i will do some operations later) and how to convert into array of ints(every 32 bits turn into the int and then put it into the array? I have never done this kind of conversion in Java. String->array of bits->(some operations I'll handle them)->array of ints 回答1: ByteBuffer bytes = ByteBuffer.wrap(string.getBytes(charset)); // you must specify a charset IntBuffer ints = bytes.asIntBuffer(); int numInts = ints.remaining(); int