Here you can find the source of toTimeZone(int gmtOffset)
public static TimeZone toTimeZone(int gmtOffset)
//package com.java2s; //License from project: Apache License import java.util.TimeZone; public class Main { /**/*from w ww . j a v a2s. c o m*/ * Returns a TimeZone object based upon an hour offset from GMT. * * @see java.util.TimeZone */ public static TimeZone toTimeZone(int gmtOffset) { if (gmtOffset > 12 || gmtOffset < -14) { throw new IllegalArgumentException("Invalid GMT offset"); } String tzId = gmtOffset > 0 ? "Etc/GMT+" : "Etc/GMT"; return TimeZone.getTimeZone(tzId + gmtOffset); } }