MCPcopy Create free account
hub / github.com/cconlon/kerberos-java-gssapi / intToByteArray

Method intToByteArray

examples/Util.java:208–216  ·  view source on GitHub ↗
(int input)

Source from the content-addressed store, hash-verified

206
207 /* Based on http://snippets.dzone.com/posts/show/93 */
208 public static byte[] intToByteArray(int input)
209 {
210 byte[] out = new byte[4];
211 for (int i = 0; i < 4; i++) {
212 int offset = (out.length - 1 - i) * 8;
213 out[i] = (byte) ((input >>> offset) & 0xFF);
214 }
215 return out;
216 }
217
218 /* Based on http://snippets.dzone.com/posts/show/93 */
219 public static int byteArrayToInt(byte[] data)

Callers 2

WriteTokenMethod · 0.95
WriteTokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected