diff options
author | PJ Fanning <fanningpj@apache.org> | 2019-09-14 09:54:11 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2019-09-14 09:54:11 +0000 |
commit | dc6a4a99e2d077ff9c9a343e218070d4df14d48d (patch) | |
tree | 2f0a8a12f9c20dcaa8e7e1b7da168c0dcf44782f /src/examples | |
parent | 8a9af96f953d1536a60c8bb667da91b4b5b5dc20 (diff) | |
download | poi-dc6a4a99e2d077ff9c9a343e218070d4df14d48d.tar.gz poi-dc6a4a99e2d077ff9c9a343e218070d4df14d48d.zip |
try to avoid casting to int
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1866933 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
3 files changed, 3 insertions, 3 deletions
diff --git a/src/examples/src/org/apache/poi/hssf/view/SVSheetTable.java b/src/examples/src/org/apache/poi/hssf/view/SVSheetTable.java index d0889cc11f..ebfb3922ea 100644 --- a/src/examples/src/org/apache/poi/hssf/view/SVSheetTable.java +++ b/src/examples/src/org/apache/poi/hssf/view/SVSheetTable.java @@ -182,7 +182,7 @@ public class SVSheetTable extends JTable { Row row = sheet.getRow(i - sheet.getFirstRowNum()); if (row != null) { short h = row.getHeight(); - int height = (int)Math.round(Math.max(1., h / (res / 70. * 20.) + 3.)); + int height = Math.toIntExact(Math.round(Math.max(1., h / (res / 70. * 20.) + 3.))); System.out.printf("%d: %d (%d @ %d)%n", i, height, h, res); setRowHeight(i, height); } diff --git a/src/examples/src/org/apache/poi/ss/examples/ToCSV.java b/src/examples/src/org/apache/poi/ss/examples/ToCSV.java index 23da1e1f02..8b9ca2822b 100644 --- a/src/examples/src/org/apache/poi/ss/examples/ToCSV.java +++ b/src/examples/src/org/apache/poi/ss/examples/ToCSV.java @@ -703,7 +703,7 @@ public class ToCSV { if (converted) { System.out.println("Conversion took " + - (int)((System.currentTimeMillis() - startTime)/1000) + " seconds"); + ((System.currentTimeMillis() - startTime)/1000) + " seconds"); } } diff --git a/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java b/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java index 622a38b80f..74221715a9 100644 --- a/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java +++ b/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java @@ -399,7 +399,7 @@ public class ToHtml { * @return the approximate number of pixels for a typical display */ protected int widthToPixels(final double widthUnits) { - return (int) (Math.round(widthUnits * 9 / 256)); + return Math.toIntExact(Math.round(widthUnits * 9 / 256)); } private void printCols(Map<Integer, Integer> widths) { |