public double snapScale(double coef) { if (getBackingUrl() != null && !getBackingUrl().isEmpty()) { double powValue = Math.log(coef) / Math.log(2); Long lPowValue = Math.round(powValue); return Math.pow(2, lPowValue); } else { return coef; } }