Here you can find the source of timestamp4(int unixTime)
http://stackoverflow.com/questions/29273498/getting-date-time-in-unix-time-as-byte-array-which-size-is-4-bytes-with-java
public static byte[] timestamp4(int unixTime)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. j a v a2 s. co m * http://stackoverflow.com/questions/29273498/getting-date-time-in-unix-time-as-byte-array-which-size-is-4-bytes-with-java * @return */ public static byte[] timestamp4(int unixTime) { byte[] productionDate = new byte[] { (byte) (unixTime >> 24), (byte) (unixTime >> 16), (byte) (unixTime >> 8), (byte) unixTime }; return productionDate; } public static byte[] timestamp4() { return timestamp4((int) (System.currentTimeMillis() / 1000)); } }