final Graphics bg = myBufferedImage.getGraphics().create();
final Runtime runtime = Runtime.getRuntime();
final long maxMemory = runtime.maxMemory();
final long freeMemory = maxMemory - runtime.totalMemory() + runtime.freeMemory();
final Insets insets = SystemInfo.isMac ? getInsets() : new Insets(0, 0, 0, 0);
<BUG>final int totalBarLength = size.width - insets.left - insets.right - (SystemInfo.isMac ? 0 : 0);
final int usedBarLength = totalBarLength - (int)(totalBarLength * freeMemory / maxMemory);</BUG>
final int allocatedBarWidth = totalBarLength - (int)(totalBarLength * (freeMemory - runtime.freeMemory()) / maxMemory);
final int barHeight = SystemInfo.isMac ? HEIGHT : size.height - insets.top - insets.bottom;
final Graphics2D g2 = (Graphics2D)bg;

final Graphics bg = myBufferedImage.getGraphics().create();
final Runtime runtime = Runtime.getRuntime();
final long maxMemory = runtime.maxMemory();
final long freeMemory = maxMemory - runtime.totalMemory() + runtime.freeMemory();
final Insets insets = SystemInfo.isMac ? getInsets() : new Insets(0, 0, 0, 0);
final int totalBarLength = size.width - insets.left - insets.right;
final int usedBarLength = totalBarLength - (int)(totalBarLength * freeMemory / maxMemory);
final int allocatedBarWidth = totalBarLength - (int)(totalBarLength * (freeMemory - runtime.freeMemory()) / maxMemory);
final int barHeight = SystemInfo.isMac ? HEIGHT : size.height - insets.top - insets.bottom;
final Graphics2D g2 = (Graphics2D)bg;
