diff --git a/pom.xml b/pom.xml
index d13bd84ae6504c06ed80f18d3f0b7cb2513105c4..d9cbb308004256256528d1e2a4c2b792dba44733 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,6 +91,13 @@
 			<version>4.11</version>
 			<scope>test</scope>
 		</dependency>
+		<!-- FEST for fluent test assertions -->
+		<dependency>
+			<groupId>org.easytesting</groupId>
+			<artifactId>fest-assert-core</artifactId>
+			<version>2.0M10</version>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
 
 	<profiles>
diff --git a/xchart/src/main/java/com/xeiam/xchart/Histogram.java b/xchart/src/main/java/com/xeiam/xchart/Histogram.java
index ffd99ce7103c07f3579a4b24b2d7b9d064fbd7c0..fa307af367129efd619afa36deb23b0f3b616a92 100644
--- a/xchart/src/main/java/com/xeiam/xchart/Histogram.java
+++ b/xchart/src/main/java/com/xeiam/xchart/Histogram.java
@@ -22,7 +22,7 @@ import java.util.List;
 
 /**
  * This class can be used to create histogram data for histogram bar charts
- * 
+ *
  * @author timmolter
  */
 public class Histogram {
@@ -36,7 +36,7 @@ public class Histogram {
 
   /**
    * Constructor
-   * 
+   *
    * @param data
    * @param numBins
    */
@@ -64,7 +64,7 @@ public class Histogram {
 
   /**
    * Constructor
-   * 
+   *
    * @param data
    * @param numBins
    * @param min
@@ -89,16 +89,15 @@ public class Histogram {
     Iterator<? extends Number> itr = originalData.iterator();
     while (itr.hasNext()) {
 
-      int bin = (int) ((((Number) itr.next()).doubleValue() - min) / binSize); // changed this from numBins
+      double doubleValue = ((Number) itr.next()).doubleValue();
+      int bin = (int) ((doubleValue - min) / binSize); // changed this from numBins
       if (bin < 0) { /* this data is smaller than min */
         // System.out.println("less than");
-      }
-      else if (bin > numBins) { /* this data point is bigger than max */
+      } else if (doubleValue == max) { // the value falls exactly on the max value
+        tempYAxisData[bin - 1] += 1;
+      } else if (bin > numBins || bin == numBins) { /* this data point is bigger than max */
         // System.out.println("greater than");
-      }
-      else if (bin == numBins) { // this falls on the next bin of the max bin
-      }
-      else {
+      } else {
         tempYAxisData[bin] += 1;
       }
     }
diff --git a/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java b/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..ebe3a080c2b43e52765122ecd8e418a1d24b67da
--- /dev/null
+++ b/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2013 Xeiam LLC.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.xeiam.xchart;
+
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+
+/**
+ * @author timmolter
+ */
+public class HistogramTest {
+
+  @Test
+  public void test1() {
+
+    Histogram histogram = new Histogram(Arrays.asList(1, 2, 3, 4, 5, 6), 2, 0, 4);
+
+    assertThat(histogram.getMax()).isEqualTo(4.0);
+    assertThat(histogram.getMin()).isEqualTo(0.0);
+    assertThat(histogram.getNumBins()).isEqualTo(2);
+    assertThat(histogram.getyAxisData().get(0) + histogram.getyAxisData().get(1)).isEqualTo(4);
+
+    //    Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).build();
+    //    chart.addSeries("histogram 1", histogram.getxAxisData(), histogram.getyAxisData());
+    //    new SwingWrapper(chart).displayChart();
+
+  }
+}