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

Method intToByteArray

examples/GssUtil.java:156–164  ·  view source on GitHub ↗
(int input)

Source from the content-addressed store, hash-verified

154
155 /* Based on http://snippets.dzone.com/posts/show/93 */
156 public static byte[] intToByteArray(int input)
157 {
158 byte[] out = new byte[4];
159 for (int i = 0; i < 4; i++) {
160 int offset = (out.length - 1 - i) * 8;
161 out[i] = (byte) ((input >>> offset) & 0xFF);
162 }
163 return out;
164 }
165
166 /* Based on http://snippets.dzone.com/posts/show/93 */
167 public static int byteArrayToInt(byte[] data)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected