Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 11th, 2012  |  syntax: None  |  size: 0.74 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public long getTime(int x, int y, int z) {
  2.         int target = ((x & 0xF) << 11 | (z & 0xF) << 7 | (y & 0x7F)) << 16;
  3.         long value;
  4.         ByteArrayInputStream bis = new ByteArrayInputStream(this.toByteArray());
  5.         DataInputStream dis = new DataInputStream(bis);
  6.         try {
  7.             while(dis.available() > 0) {
  8.                 value = dis.readLong();
  9.                 if (((int) (value & 0xFFFF0000)) == target) return value;
  10.             }
  11.         } catch (IOException e) {
  12.             // yeah blah memory, i dont care.
  13.         } finally {
  14.             try {
  15.                 dis.close();
  16.                 bis.close();
  17.             } catch (IOException e) {
  18.             }
  19.         }
  20.         return Long.MAX_VALUE;
  21.     }