posted 15 years ago
Declare your unixTime as long instead of int.
Both 1244466958 and 1000 are ints. Therefore, although you assign the result to a long variable, the result of the multiplication is int as well. 1244466958000 is larger than Integer.MAX_VALUE so it will be wrapped to -1073557840.
If you declare unixTime as a long, the result of unixTime * 1000 will also be a long and therefore be 1244466958000.
Alternatively, you can upgrade the 1000 to a long by turning it into 1000L.