Java snippet for determining screen details