Re-fix segmentation logic
diff --git a/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java b/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java
index fe518a1..b22e02b 100644
--- a/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java
+++ b/src/main/java/com/intel/jndn/utils/server/SegmentedServerHelper.java
@@ -58,9 +58,9 @@
List<Data> segments = new ArrayList<>();
byte[] buffer_ = readAll(bytes);
ByteBuffer buffer = ByteBuffer.wrap(buffer_, 0, buffer_.length);
- int end = Math.max((int) Math.floor(buffer_.length / segmentSize), 1);
+ int end = (int) Math.floor(buffer_.length / (segmentSize + 1));
Name.Component lastSegment = Name.Component.fromNumberWithMarker(end, 0x00);
- for (int i = 0; i < end; i++) {
+ for (int i = 0; i <= end; i++) {
Data segment = new Data(template);
segment.getName().appendSegment(i);
segment.getMetaInfo().setFinalBlockId(lastSegment);