This is an automated email from the ASF dual-hosted git repository.

leirui pushed a commit to branch research/M4-visualization
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/research/M4-visualization by 
this push:
     new 9b7ba2159f milestone
9b7ba2159f is described below

commit 9b7ba2159f97b103d6bc70f15e84cd8990ac7ad9
Author: Lei Rui <[email protected]>
AuthorDate: Tue Oct 11 10:19:50 2022 +0800

    milestone
---
 .../iotdb/session/MyBasicOperationTest2.java       |  12 +-
 .../iotdb/session/MyBasicOperationTest3.java       |  31 +--
 .../iotdb/session/MyBasicOperationTest4.java       | 186 ++++++++++++++++
 .../session/MyRealDataTest1_WriteAndQuery.java     | 125 +++++------
 .../tsfile/common/constant/TsFileConstant.java     |  26 +--
 .../encoding/decoder/DeltaBinaryDecoder.java       |  46 ++--
 .../iotdb/tsfile/read/reader/page/PageReader.java  |   6 +-
 .../org/apache/iotdb/tsfile/utils/BytesUtils.java  | 237 ++++++++++++---------
 8 files changed, 434 insertions(+), 235 deletions(-)

diff --git 
a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest2.java 
b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest2.java
index 819054b5e4..9f91e555a6 100644
--- a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest2.java
+++ b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest2.java
@@ -1,9 +1,11 @@
 package org.apache.iotdb.session;
 
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+
 import java.text.DecimalFormat;
 import java.util.Random;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
 
 public class MyBasicOperationTest2 {
 
@@ -48,12 +50,12 @@ public class MyBasicOperationTest2 {
         // op2_b: 把一个byte的高位x个比特装到一个long的低位x个比特
         // TODO 如何把一个byte一次分成高位x个比特和低位y个比特
         System.out.println("---");
-//        System.out.println(buf[i]);
-//        System.out.println((buf[i] & 0xff & 0b11100000) >> 5);
+        //        System.out.println(buf[i]);
+        //        System.out.println((buf[i] & 0xff & 0b11100000) >> 5);
         sum += (buf[i] & 0xff & 0b11100000) >> 5;
 
         // op2_c: 把一个byte的低位y个比特装到一个long的从低位到高位pos=packWidth-1的开始
-//        System.out.println((buf[i] & 0xff & ~0b11100000) << 3);
+        //        System.out.println((buf[i] & 0xff & ~0b11100000) << 3);
         sum += (buf[i] & 0xff & ~0b11100000) << 3;
 
         // op2_d: 把一个byte里的一部分比特装到一个long里
diff --git 
a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest3.java 
b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest3.java
index 0064940891..fed79ebeda 100644
--- a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest3.java
+++ b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest3.java
@@ -1,22 +1,25 @@
 package org.apache.iotdb.session;
 
-import java.io.IOException;
-import java.text.DecimalFormat;
-import java.util.Random;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.utils.BytesUtils;
+
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 import org.junit.Assert;
 
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.util.Random;
+
 public class MyBasicOperationTest3 {
 
   public static void main(String[] args) throws IOException {
     // op1: long v = BytesUtils.bytesToLong(deltaBuf, packWidth * i, 
packWidth);
-    // op2: put bytes as a whole into long, i.e., 
BytesUtils.bytesToLong2(deltaBuf, packWidth * i, packWidth);
+    // op2: put bytes as a whole into long, i.e., 
BytesUtils.bytesToLong2(deltaBuf, packWidth * i,
+    // packWidth);
 
     int repeat = 1000000;
     int packNum = 128;
-    int packWidth = 9;
+    int packWidth = 11;
 
     int[] fallWithinMasks;
     if (packWidth < 8) {
@@ -35,7 +38,7 @@ public class MyBasicOperationTest3 {
       byte[] buf = new byte[packNum * 8];
       for (int i = 0; i < packNum; i++) {
         int v = r.nextInt(high - low) + low;
-//        int v = 1;
+        //        int v = 1;
         BytesUtils.longToBytes(v, buf, i * packWidth, packWidth);
       }
 
@@ -44,11 +47,11 @@ public class MyBasicOperationTest3 {
       long start = System.nanoTime();
       for (int i = 0; i < packNum; i++) {
         value1[i] = BytesUtils.bytesToLong(buf, packWidth * i, packWidth);
-//        System.out.println(BytesUtils.bytesToLong(buf, packWidth * i, 
packWidth));
+        //        System.out.println(BytesUtils.bytesToLong(buf, packWidth * 
i, packWidth));
       }
       long elapsedTime = System.nanoTime() - start;
-//      System.out.println(elapsedTime / 1000.0 + "us");
-//      System.out.println(sum);
+      //      System.out.println(elapsedTime / 1000.0 + "us");
+      //      System.out.println(sum);
       op1.addValue(elapsedTime / 1000.0);
 
       // test op2
@@ -56,12 +59,12 @@ public class MyBasicOperationTest3 {
       start = System.nanoTime();
       for (int i = 0; i < packNum; i++) {
         value2[i] = BytesUtils.bytesToLong2(buf, packWidth * i, packWidth, 
fallWithinMasks);
-//        System.out.println(BytesUtils.bytesToLong2(buf, packWidth * i, 
packWidth));
-//        Assert.assertEquals(value1[i], value2[i]);
+        //        System.out.println(BytesUtils.bytesToLong2(buf, packWidth * 
i, packWidth));
+        //        Assert.assertEquals(value1[i], value2[i]);
       }
       elapsedTime = System.nanoTime() - start;
-//      System.out.println(elapsedTime / 1000.0 + "us");
-//      System.out.println(sum2);
+      //      System.out.println(elapsedTime / 1000.0 + "us");
+      //      System.out.println(sum2);
       op2.addValue(elapsedTime / 1000.0);
 
       System.out.println("---------------");
diff --git 
a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest4.java 
b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest4.java
new file mode 100644
index 0000000000..c41a1bc5ff
--- /dev/null
+++ b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest4.java
@@ -0,0 +1,186 @@
+package org.apache.iotdb.session;
+
+import java.text.DecimalFormat;
+import java.util.Random;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+import org.junit.Assert;
+
+public class MyBasicOperationTest4 {
+
+  public static void main(String[] args) {
+    // op1: iterate a byte bit-by-bit to convert into two numbers
+    // op2: use masks twice on a byte to convert into two number
+
+    // prepare data
+    int repeat = 100000000;
+    Random r = new Random();
+    byte[] buf = new byte[repeat];
+    r.nextBytes(buf);
+    int splitPos = 3; // the start pos of the second number, from high to low 
bits starting from 0
+    int mask1 = 0b11100000;
+    int mask2 = 0b00011111;
+    DescriptiveStatistics op1 = new DescriptiveStatistics();
+    DescriptiveStatistics op2 = new DescriptiveStatistics();
+    int packWidth = 10;
+
+    // test op1
+//    System.out.println("op1");
+//    long[] op1_v1 = new long[repeat];
+//    long[] op1_v2 = new long[repeat];
+//    long start = System.nanoTime();
+//    for (int i = 0; i < repeat; i++) {
+//      int mask = 0b10000000;
+//      long v1 = 0;
+//      long v2 = 0;
+//      for (int k = 0; k < 8; k++) {
+//        if (k < splitPos) {
+//          v1 = v1 | (buf[i] & mask);
+//          mask = mask >> 1;
+//        } else {
+//          v2 = v2 | (buf[i] & mask);
+//          mask = mask >> 1;
+//        }
+//      }
+//      op1_v1[i] = v1 >> 5;
+//      op1_v2[i] = v2 << (packWidth - (8 - splitPos));
+//    }
+//    long elapsedTime = System.nanoTime() - start;
+//    op1.addValue(elapsedTime / 1000.0);
+
+//    System.out.println("op1");
+//    long[] op1_v1 = new long[repeat];
+//    long[] op1_v2 = new long[repeat];
+//    long start = System.nanoTime();
+//    for (int i = 0; i < repeat; i++) {
+//      long v1 = 0;
+//      long v2 = 0;
+//      char[] v = Long.toBinaryString(buf[i] & 0xff).toCharArray();
+////      System.out.println(v);
+//      for (int k = 8 - v.length; k < 8; k++) {
+//        if (k < splitPos) {
+//          v1 = v1 << 1;
+//          v1 = v1 + Character.getNumericValue(v[k - 8 + v.length]);
+//        } else {
+//          v2 = v2 << 1;
+//          v2 = v2 + Character.getNumericValue(v[k - 8 + v.length]);
+//        }
+//      }
+//      op1_v1[i] = v1;
+//      op1_v2[i] = v2 << (packWidth - (8 - splitPos));
+////      System.out.println(op1_v1[i]);
+////      System.out.println(op1_v2[i]);
+//    }
+//    long elapsedTime = System.nanoTime() - start;
+//    op1.addValue(elapsedTime / 1000.0);
+
+    System.out.println("op1");
+//    long[] op1_v1 = new long[repeat];
+//    long[] op1_v2 = new long[repeat];
+    long sum1 = 0;
+    long start = System.nanoTime();
+    for (int i = 0; i < repeat; i++) {
+      long v1 = 0;
+      long v2 = 0;
+      int data = buf[i] & 0xff;
+      for (int k = 7; k >= 0; k--) {
+        int b = data % 2;
+        data /= 2;
+        if (k < splitPos) {
+          v1 = v1 + (b << (splitPos - k - 1));
+        } else {
+          v2 = v2 + (b << (7 - k));
+        }
+      }
+//      op1_v1[i] = v1;
+//      op1_v2[i] = v2 << (packWidth - (8 - splitPos));
+//      System.out.println(op1_v1[i]);
+//      System.out.println(op1_v2[i]);
+      sum1 += v1;
+      sum1 += v2 << (packWidth - (8 - splitPos));
+    }
+    long elapsedTime = System.nanoTime() - start;
+    op1.addValue(elapsedTime / 1000.0);
+
+    // test op2
+    System.out.println("op2");
+//    long[] op2_v1 = new long[repeat];
+//    long[] op2_v2 = new long[repeat];
+    long sum2 = 0;
+    start = System.nanoTime();
+    for (int i = 0; i < repeat; i++) {
+      byte data = buf[i];
+      long v1 = 0;
+      long v2 = 0;
+//      op2_v1[i] = v1 | ((data & mask1) >> 5);
+//      op2_v2[i] = v2 | ((data & mask2) << (packWidth - (8 - splitPos)));
+//      System.out.println(op2_v1[i]);
+//      System.out.println(op2_v2[i]);
+      sum2 += v1 | ((data & mask1) >> 5);
+      sum2 += v2 | ((data & mask2) << (packWidth - (8 - splitPos)));
+    }
+    elapsedTime = System.nanoTime() - start;
+    op2.addValue(elapsedTime / 1000.0);
+
+//    for (int i = 0; i < repeat; i++) {
+//      Assert.assertEquals(op1_v1[i], op2_v1[i]);
+//      Assert.assertEquals(op1_v2[i], op2_v2[i]);
+//    }
+    Assert.assertEquals(sum1, sum2);
+
+    printStat(op1, "op1-iterateBits");
+    printStat(op2, "op2-useMasks");
+    System.out.println("op1/op2=" + op1.getMean() / op2.getMean());
+    System.out.println("op2/op1=" + op2.getMean() / op1.getMean());
+  }
+
+  private static String printStat(DescriptiveStatistics statistics, String 
name) {
+    DecimalFormat df = new DecimalFormat("#,###.00");
+    double max = statistics.getMax();
+    double min = statistics.getMin();
+    double mean = statistics.getMean();
+    double std = statistics.getStandardDeviation();
+    double p25 = statistics.getPercentile(25);
+    double p50 = statistics.getPercentile(50);
+    double p75 = statistics.getPercentile(75);
+    double p90 = statistics.getPercentile(90);
+    double p95 = statistics.getPercentile(95);
+    String res =
+        name
+            + "_stats"
+            + ": "
+            + "num="
+            + statistics.getN()
+            + ", "
+            + "sum="
+            + df.format(statistics.getSum())
+            + "us,"
+            + "mean="
+            + df.format(mean)
+            + ", "
+            + "min="
+            + df.format(min)
+            + ", "
+            + "max="
+            + df.format(max)
+            + ", "
+            + "std="
+            + df.format(std)
+            + ", "
+            + "p25="
+            + df.format(p25)
+            + ", "
+            + "p50="
+            + df.format(p50)
+            + ", "
+            + "p75="
+            + df.format(p75)
+            + ", "
+            + "p90="
+            + df.format(p90)
+            + ", "
+            + "p95="
+            + df.format(p95);
+    System.out.println(res);
+    return res;
+  }
+}
diff --git 
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
 
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
index 10f8235500..60335adcfc 100644
--- 
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
+++ 
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
@@ -53,29 +53,30 @@ public class MyRealDataTest1_WriteAndQuery {
   private static final String queryFormat_UDF =
       "select M4(%1$s,'tqs'='%3$d','tqe'='%4$d','w'='%5$d') from %2$s where 
time>=%3$d and time<%4$d";
 
-    private static String device = "root.game";
-    private static String measurement = "s6";
-    private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
-    private static String timestamp_precision = "ns"; // ns, us, ms
-    private static long dataMinTime = 0;
-    private static long dataMaxTime = 617426057626L;
-    private static long total_time_length = dataMaxTime - dataMinTime;
-    private static int total_point_number = 1200000;
-    private static int iotdb_chunk_point_size = 100000;
-    private static long chunkAvgTimeLen = (long) Math
-        .ceil(total_time_length / Math.ceil(total_point_number * 1.0 / 
iotdb_chunk_point_size));
-    private static String filePath =
-
-   
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\BallSpeed.csv";
-    private static int deletePercentage = 0; // 0 means no deletes. 0-100
-    private static int deleteLenPercentage = 0; // 0-100 
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
-    private static int timeIdx = 0; // 时间戳idx,从0开始
-    private static int valueIdx = 1; // 值idx,从0开始
-    private static int w = 2;
-    private static long range = total_time_length;
-    private static boolean enableRegularityTimeDecode = true;
-    private static long regularTimeInterval = 511996L;
-    private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
+  //    private static String device = "root.game";
+  //    private static String measurement = "s6";
+  //    private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
+  //    private static String timestamp_precision = "ns"; // ns, us, ms
+  //    private static long dataMinTime = 0;
+  //    private static long dataMaxTime = 617426057626L;
+  //    private static long total_time_length = dataMaxTime - dataMinTime;
+  //    private static int total_point_number = 1200000;
+  //    private static int iotdb_chunk_point_size = 100000;
+  //    private static long chunkAvgTimeLen = (long) Math
+  //        .ceil(total_time_length / Math.ceil(total_point_number * 1.0 / 
iotdb_chunk_point_size));
+  //    private static String filePath =
+  //
+  //
+  // 
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\BallSpeed.csv";
+  //    private static int deletePercentage = 0; // 0 means no deletes. 0-100
+  //    private static int deleteLenPercentage = 0; // 0-100 
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
+  //    private static int timeIdx = 0; // 时间戳idx,从0开始
+  //    private static int valueIdx = 1; // 值idx,从0开始
+  //    private static int w = 2;
+  //    private static long range = total_time_length;
+  //    private static boolean enableRegularityTimeDecode = true;
+  //    private static long regularTimeInterval = 511996L;
+  //    private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 
3: CPV
 
   //  private static String device = "root.debs2012";
   //  private static String measurement = "mf03";
@@ -101,39 +102,14 @@ public class MyRealDataTest1_WriteAndQuery {
   //  private static long regularTimeInterval = 10000900L;
   //  private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: 
CPV
 
-//  private static String device = "root.debs2012";
-//  private static String measurement = "mf03";
-//  private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
-//  private static String timestamp_precision = "ns"; // ns, us, ms
-//  private static long dataMinTime = 1329955200008000000L;
-//  private static long dataMaxTime = 1329965999991000000L;
-//  private static long total_time_length = dataMaxTime - dataMinTime;
-//  private static int total_point_number = 1076102;
-//  private static int iotdb_chunk_point_size = 100000;
-//  private static long chunkAvgTimeLen =
-//      (long)
-//          Math.ceil(
-//              total_time_length / Math.ceil(total_point_number * 1.0 / 
iotdb_chunk_point_size));
-//  private static String filePath =
-//      
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\MF03_2.csv";
-//  private static int deletePercentage = 0; // 0 means no deletes. 0-100
-//  private static int deleteLenPercentage = 0; // 0-100 
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
-//  private static int timeIdx = 0; // 时间戳idx,从0开始
-//  private static int valueIdx = 1; // 值idx,从0开始
-//  private static int w = 2;
-//  private static long range = total_time_length;
-//  private static boolean enableRegularityTimeDecode = true;
-//  private static long regularTimeInterval = 10000000L;
-//  private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
-
-  //  private static String device = 
"root.kobelco.trans.03.1090001603.2401604";
-  //  private static String measurement = "KOB_0002_00_67";
+  //  private static String device = "root.debs2012";
+  //  private static String measurement = "mf03";
   //  private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
-  //  private static String timestamp_precision = "ms"; // ns, us, ms
-  //  private static long dataMinTime = 1616805035973L;
-  //  private static long dataMaxTime = 1627380839563L;
+  //  private static String timestamp_precision = "ns"; // ns, us, ms
+  //  private static long dataMinTime = 1329955200008000000L;
+  //  private static long dataMaxTime = 1329965999991000000L;
   //  private static long total_time_length = dataMaxTime - dataMinTime;
-  //  private static int total_point_number = 1943180;
+  //  private static int total_point_number = 1076102;
   //  private static int iotdb_chunk_point_size = 100000;
   //  private static long chunkAvgTimeLen =
   //      (long)
@@ -141,26 +117,25 @@ public class MyRealDataTest1_WriteAndQuery {
   //              total_time_length / Math.ceil(total_point_number * 1.0 / 
iotdb_chunk_point_size));
   //  private static String filePath =
   //
-  //
-  // 
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB.csv";
+  // 
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\MF03_2.csv";
   //  private static int deletePercentage = 0; // 0 means no deletes. 0-100
   //  private static int deleteLenPercentage = 0; // 0-100 
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
   //  private static int timeIdx = 0; // 时间戳idx,从0开始
   //  private static int valueIdx = 1; // 值idx,从0开始
-  //  private static int w = 3;
+  //  private static int w = 2;
   //  private static long range = total_time_length;
   //  private static boolean enableRegularityTimeDecode = true;
-  //  private static long regularTimeInterval = 1000L;
+  //  private static long regularTimeInterval = 10000000L;
   //  private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: 
CPV
 
   //  private static String device = 
"root.kobelco.trans.03.1090001603.2401604";
   //  private static String measurement = "KOB_0002_00_67";
   //  private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
   //  private static String timestamp_precision = "ms"; // ns, us, ms
-  //  private static long dataMinTime = 1616805035000L;
-  //  private static long dataMaxTime = 1627380839000L;
+  //  private static long dataMinTime = 1616805035973L;
+  //  private static long dataMaxTime = 1627380839563L;
   //  private static long total_time_length = dataMaxTime - dataMinTime;
-  //  private static int total_point_number = 1860287;
+  //  private static int total_point_number = 1943180;
   //  private static int iotdb_chunk_point_size = 100000;
   //  private static long chunkAvgTimeLen =
   //      (long)
@@ -168,7 +143,8 @@ public class MyRealDataTest1_WriteAndQuery {
   //              total_time_length / Math.ceil(total_point_number * 1.0 / 
iotdb_chunk_point_size));
   //  private static String filePath =
   //
-  // 
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB_2.csv";
+  //
+  // 
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB.csv";
   //  private static int deletePercentage = 0; // 0 means no deletes. 0-100
   //  private static int deleteLenPercentage = 0; // 0-100 
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
   //  private static int timeIdx = 0; // 时间戳idx,从0开始
@@ -179,6 +155,31 @@ public class MyRealDataTest1_WriteAndQuery {
   //  private static long regularTimeInterval = 1000L;
   //  private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: 
CPV
 
+  private static String device = "root.kobelco.trans.03.1090001603.2401604";
+  private static String measurement = "KOB_0002_00_67";
+  private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
+  private static String timestamp_precision = "ms"; // ns, us, ms
+  private static long dataMinTime = 1616805035000L;
+  private static long dataMaxTime = 1627380839000L;
+  private static long total_time_length = dataMaxTime - dataMinTime;
+  private static int total_point_number = 1860287;
+  private static int iotdb_chunk_point_size = 100000;
+  private static long chunkAvgTimeLen =
+      (long)
+          Math.ceil(
+              total_time_length / Math.ceil(total_point_number * 1.0 / 
iotdb_chunk_point_size));
+  private static String filePath =
+      
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB_2.csv";
+  private static int deletePercentage = 0; // 0 means no deletes. 0-100
+  private static int deleteLenPercentage = 0; // 0-100 
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
+  private static int timeIdx = 0; // 时间戳idx,从0开始
+  private static int valueIdx = 1; // 值idx,从0开始
+  private static int w = 3;
+  private static long range = total_time_length;
+  private static boolean enableRegularityTimeDecode = true;
+  private static long regularTimeInterval = 1000L;
+  private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
+
   //  private static String device = "root.sg1";
   //  private static String measurement = "RcvTime";
   //  private static TSDataType tsDataType = TSDataType.INT64; // 
TSDataType.DOUBLE;
diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
index 1ef5630c1c..606fab6ad8 100644
--- 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
+++ 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
@@ -18,9 +18,10 @@
  */
 package org.apache.iotdb.tsfile.common.constant;
 
-import java.io.IOException;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 
+import java.io.IOException;
+
 public class TsFileConstant {
 
   public static final String TSFILE_SUFFIX = ".tsfile";
@@ -63,23 +64,11 @@ public class TsFileConstant {
   public static long byteToLong_byteNums_middleWholeByte = 0;
 
   public static int[] endInByteMasks = {
-      0b01111111,
-      0b00111111,
-      0b00011111,
-      0b00001111,
-      0b00000111,
-      0b00000011,
-      0b00000001
+    0b01111111, 0b00111111, 0b00011111, 0b00001111, 0b00000111, 0b00000011, 
0b00000001
   };
 
   public static int[] startInByteMasks = {
-      0b10000000,
-      0b11000000,
-      0b11100000,
-      0b11110000,
-      0b11111000,
-      0b11111100,
-      0b11111110
+    0b10000000, 0b11000000, 0b11100000, 0b11110000, 0b11111000, 0b11111100, 
0b11111110
   };
 
   /**
@@ -100,8 +89,7 @@ public class TsFileConstant {
     return res;
   }
 
-  private TsFileConstant() {
-  }
+  private TsFileConstant() {}
 
   public static void printByteToLongStatistics() {
     System.out.println("bytesToLong_byteNum1_wholeByte=" + 
bytesToLong_byteNum1_wholeByte);
@@ -114,7 +102,7 @@ public class TsFileConstant {
         "byteToLong_byteNums_lastByte_wholeByte=" + 
byteToLong_byteNums_lastByte_wholeByte);
     System.out.println(
         "byteToLong_byteNums_lastByte_smallByte=" + 
byteToLong_byteNums_lastByte_smallByte);
-    System.out
-        .println("byteToLong_byteNums_middleWholeByte=" + 
byteToLong_byteNums_middleWholeByte);
+    System.out.println(
+        "byteToLong_byteNums_middleWholeByte=" + 
byteToLong_byteNums_middleWholeByte);
   }
 }
diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
index a4c382455d..ace85f5311 100644
--- 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
+++ 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
@@ -19,10 +19,6 @@
 
 package org.apache.iotdb.tsfile.encoding.decoder;
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.encoding.encoder.DeltaBinaryEncoder;
@@ -31,9 +27,15 @@ import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.iotdb.tsfile.utils.Pair;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * This class is a decoder for decoding the byte array that encoded by {@code
- * DeltaBinaryEncoder}.DeltaBinaryDecoder just supports integer and long 
values.<br> .
+ * DeltaBinaryEncoder}.DeltaBinaryDecoder just supports integer and long 
values.<br>
+ * .
  *
  * @see DeltaBinaryEncoder
  */
@@ -42,24 +44,16 @@ public abstract class DeltaBinaryDecoder extends Decoder {
   protected long count = 0;
   protected byte[] deltaBuf;
 
-  /**
-   * the first value in one pack.
-   */
+  /** the first value in one pack. */
   protected int readIntTotalCount = 0;
 
   protected int nextReadIndex = 0;
-  /**
-   * max bit length of all value in a pack.
-   */
+  /** max bit length of all value in a pack. */
   protected int packWidth;
-  /**
-   * data number in this pack.
-   */
+  /** data number in this pack. */
   protected int packNum;
 
-  /**
-   * how many bytes data takes after encoding.
-   */
+  /** how many bytes data takes after encoding. */
   protected int encodingLength;
 
   public DeltaBinaryDecoder() {
@@ -92,9 +86,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
     private int firstValue;
     private int[] data;
     private int previous;
-    /**
-     * minimum value for all difference.
-     */
+    /** minimum value for all difference. */
     private int minDeltaBase;
 
     public IntDeltaDecoder() {
@@ -178,9 +170,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
     private long firstValue;
     private long[] data;
     private long previous;
-    /**
-     * minimum value for all difference.
-     */
+    /** minimum value for all difference. */
     private long minDeltaBase;
 
     private boolean enableRegularityTimeDecode;
@@ -268,7 +258,8 @@ public abstract class DeltaBinaryDecoder extends Decoder {
           byte[][] regularBytes;
           if (allRegularBytes.containsKey(new Pair<>(newRegularDelta, 
packWidth))) {
             regularBytes = allRegularBytes.get(new Pair<>(newRegularDelta, 
packWidth));
-          } else {  // TODO consider if the following steps can be accelerated 
by using bytes instead of bitwise get and set
+          } else { // TODO consider if the following steps can be accelerated 
by using bytes instead
+            // of bitwise get and set
             regularBytes = new byte[8][]; // 8 relative positions. 
relativePos->bytes
             for (int i = 0; i < 8; i++) {
               // i is the starting position in the byte from high to low bits
@@ -321,8 +312,9 @@ public abstract class DeltaBinaryDecoder extends Decoder {
 
             boolean equal = true;
 
-            int pos = i * packWidth
-                % 8; // the starting relative position in the byte from high 
to low bits
+            int pos =
+                i * packWidth
+                    % 8; // the starting relative position in the byte from 
high to low bits
 
             byte[] byteArray = regularBytes[pos]; // the regular padded bytes 
to be compared
 
@@ -339,9 +331,11 @@ public abstract class DeltaBinaryDecoder extends Decoder {
 
             if (equal) {
               data[i] = previous + regularTimeInterval;
+              //              TsFileConstant.countForRegularEqual++;
             } else {
               long v = BytesUtils.bytesToLong2(deltaBuf, packWidth * i, 
packWidth, fallWithinMasks);
               data[i] = previous + minDeltaBase + v;
+              //              TsFileConstant.countForRegularNOTEqual++;
             }
             previous = data[i];
           }
diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java
index a0c1fef97e..870994f939 100644
--- 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java
+++ 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java
@@ -269,15 +269,15 @@ public class PageReader implements IPageReader {
   @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity 
warning
   @Override
   public BatchData getAllSatisfiedPageData(boolean ascending) throws 
IOException {
-
+    // TODO: return null(value no need) or FP&LP
     BatchData pageData = BatchDataFactory.createBatchData(dataType, ascending, 
false);
 
-    while (timeDecoder.hasNext(timeBuffer)) {
+    while (timeDecoder.hasNext(timeBuffer)) { // TODO: timeDecoder.data
       long timestamp = timeDecoder.readLong(timeBuffer);
       switch (dataType) {
         case BOOLEAN:
           boolean aBoolean = valueDecoder.readBoolean(valueBuffer);
-          if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aBoolean))) {
+          if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aBoolean))) { // TODO:remove
             pageData.putBoolean(timestamp, aBoolean);
           }
           break;
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BytesUtils.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BytesUtils.java
index 1829b41a62..e0b37ef0c8 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BytesUtils.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BytesUtils.java
@@ -18,24 +18,27 @@
  */
 package org.apache.iotdb.tsfile.utils;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
 import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
 /**
  * BytesUtils is a utility class. It provide conversion among byte array and 
other type including
- * integer, long, float, boolean, double and string. <br> It also provide 
other usable function as
- * follow:<br> reading function which receives InputStream. <br> concat 
function to join a list of
- * byte array to one.<br> get and set one bit in a byte array.
+ * integer, long, float, boolean, double and string. <br>
+ * It also provide other usable function as follow:<br>
+ * reading function which receives InputStream. <br>
+ * concat function to join a list of byte array to one.<br>
+ * get and set one bit in a byte array.
  */
 public class BytesUtils {
 
-  private BytesUtils() {
-  }
+  private BytesUtils() {}
 
   private static final Logger LOG = LoggerFactory.getLogger(BytesUtils.class);
 
@@ -46,20 +49,19 @@ public class BytesUtils {
    * @return byte[4] for integer
    */
   public static byte[] intToBytes(int i) {
-    return new byte[]{
-        (byte) ((i >> 24) & 0xFF),
-        (byte) ((i >> 16) & 0xFF),
-        (byte) ((i >> 8) & 0xFF),
-        (byte) (i & 0xFF)
+    return new byte[] {
+      (byte) ((i >> 24) & 0xFF),
+      (byte) ((i >> 16) & 0xFF),
+      (byte) ((i >> 8) & 0xFF),
+      (byte) (i & 0xFF)
     };
   }
 
   /**
-   * integer convert to byte array, then write four bytes to parameter desc 
start from
-   * index:offset.
+   * integer convert to byte array, then write four bytes to parameter desc 
start from index:offset.
    *
-   * @param i      integer to convert
-   * @param desc   byte array be written
+   * @param i integer to convert
+   * @param desc byte array be written
    * @param offset position in desc byte array that conversion result should 
start
    * @return byte array
    */
@@ -80,8 +82,8 @@ public class BytesUtils {
    *
    * @param srcNum input integer variable
    * @param result byte array to convert
-   * @param pos    start position
-   * @param width  bit-width
+   * @param pos start position
+   * @param width bit-width
    */
   public static void intToBytes(int srcNum, byte[] result, int pos, int width) 
{
     int temp = 0;
@@ -159,7 +161,7 @@ public class BytesUtils {
   /**
    * convert four-bytes byte array cut from parameters to integer.
    *
-   * @param bytes  source bytes which length should be greater than 4
+   * @param bytes source bytes which length should be greater than 4
    * @param offset position in parameter byte array that conversion result 
should start
    * @return integer
    */
@@ -181,8 +183,8 @@ public class BytesUtils {
    * given a byte array, read width bits from specified position bits and 
convert it to an integer.
    *
    * @param result input byte array
-   * @param pos    bit offset rather than byte offset
-   * @param width  bit-width
+   * @param pos bit offset rather than byte offset
+   * @param width bit-width
    * @return integer variable
    */
   public static int bytesToInt(byte[] result, int pos, int width) {
@@ -216,8 +218,8 @@ public class BytesUtils {
   /**
    * float convert to boolean, then write four bytes to parameter desc start 
from index:offset.
    *
-   * @param x      float
-   * @param desc   byte array be written
+   * @param x float
+   * @param desc byte array be written
    * @param offset position in desc byte array that conversion result should 
start
    */
   public static void floatToBytes(float x, byte[] desc, int offset) {
@@ -256,7 +258,7 @@ public class BytesUtils {
   /**
    * convert four-bytes byte array cut from parameters to float.
    *
-   * @param b      source bytes which length should be greater than 4
+   * @param b source bytes which length should be greater than 4
    * @param offset position in parameter byte array that conversion result 
should start
    * @return float
    */
@@ -295,8 +297,8 @@ public class BytesUtils {
   /**
    * convert double to byte into the given byte array started from offset.
    *
-   * @param d      input double
-   * @param bytes  target byte[]
+   * @param d input double
+   * @param bytes target byte[]
    * @param offset start pos
    */
   public static void doubleToBytes(double d, byte[] bytes, int offset) {
@@ -339,7 +341,7 @@ public class BytesUtils {
   /**
    * convert eight-bytes byte array cut from parameters to double.
    *
-   * @param bytes  source bytes which length should be greater than 8
+   * @param bytes source bytes which length should be greater than 8
    * @param offset position in parameter byte array that conversion result 
should start
    * @return double
    */
@@ -394,11 +396,10 @@ public class BytesUtils {
   }
 
   /**
-   * boolean convert to byte array, then write four bytes to parameter desc 
start from
-   * index:offset.
+   * boolean convert to byte array, then write four bytes to parameter desc 
start from index:offset.
    *
-   * @param x      input boolean
-   * @param desc   byte array be written
+   * @param x input boolean
+   * @param desc byte array be written
    * @param offset position in desc byte array that conversion result should 
start
    * @return byte[1]
    */
@@ -428,7 +429,7 @@ public class BytesUtils {
   /**
    * convert one-bytes byte array cut from parameters to boolean.
    *
-   * @param b      source bytes which length should be greater than 1
+   * @param b source bytes which length should be greater than 1
    * @param offset position in parameter byte array that conversion result 
should start
    * @return boolean
    */
@@ -452,9 +453,10 @@ public class BytesUtils {
 
   /**
    * specify the result array length. then, convert long to Big-Endian byte 
from low to high. <br>
-   * e.g.<br> the binary presentation of long number 1000L is {6 bytes equal 
0000000} 00000011
-   * 11101000<br> if len = 2, it will return byte array :{00000011 
11101000}(Big-Endian) if len = 1,
-   * it will return byte array :{11101000}.
+   * e.g.<br>
+   * the binary presentation of long number 1000L is {6 bytes equal 0000000} 
00000011 11101000<br>
+   * if len = 2, it will return byte array :{00000011 11101000}(Big-Endian) if 
len = 1, it will
+   * return byte array :{11101000}.
    *
    * @param num long variable to be converted
    * @param len length of result byte array
@@ -471,8 +473,8 @@ public class BytesUtils {
   /**
    * long convert to byte array, then write four bytes to parameter desc start 
from index:offset.
    *
-   * @param num    input long variable
-   * @param desc   byte array be written
+   * @param num input long variable
+   * @param desc byte array be written
    * @param offset position in desc byte array that conversion result should 
start
    * @return byte array
    */
@@ -490,8 +492,8 @@ public class BytesUtils {
    *
    * @param srcNum input long variable
    * @param result byte array to convert
-   * @param pos    start position
-   * @param width  bit-width
+   * @param pos start position
+   * @param width bit-width
    */
   public static void longToBytes(long srcNum, byte[] result, int pos, int 
width) {
     int temp = 0;
@@ -510,6 +512,20 @@ public class BytesUtils {
     }
   }
 
+  /**
+   * convert an long to a byte array which length is width, then copy this 
array to the parameter
+   * result from pos.
+   *
+   * @param srcNum input long variable
+   * @param result byte array to convert
+   * @param pos start position
+   * @param width bit-width
+   */
+  public static void longToBytes2(long srcNum, byte[] result, int pos, int 
width) {
+    // TODO new implementation
+
+  }
+
   /**
    * convert byte array to long with default length 8. namely.
    *
@@ -523,11 +539,12 @@ public class BytesUtils {
   /**
    * specify the input byte array length. then, convert byte array to long 
value from low to high.
    * <br>
-   * e.g.<br> the input byte array is {00000011 11101000}. if len = 2, return 
1000 if len = 1,
-   * return 232(only calculate the low byte).
+   * e.g.<br>
+   * the input byte array is {00000011 11101000}. if len = 2, return 1000 if 
len = 1, return
+   * 232(only calculate the low byte).
    *
    * @param byteNum byte array to be converted
-   * @param len     length of input byte array to be converted
+   * @param len length of input byte array to be converted
    * @return long
    */
   public static long bytesToLong(byte[] byteNum, int len) {
@@ -543,8 +560,8 @@ public class BytesUtils {
    * given a byte array, read width bits from specified pos bits and convert 
it to an long.
    *
    * @param result input byte array
-   * @param pos    bit offset rather than byte offset
-   * @param width  bit-width
+   * @param pos bit offset rather than byte offset
+   * @param width bit-width
    * @return long variable
    */
   public static long bytesToLong(byte[] result, int pos, int width) {
@@ -560,12 +577,11 @@ public class BytesUtils {
   /**
    * given a byte array, read width bits from specified pos bits and convert 
it to an long.
    *
-   * @param result          input byte array
-   * @param pos             bit offset rather than byte offset
-   * @param width           bit-width
+   * @param result input byte array
+   * @param pos bit offset rather than byte offset
+   * @param width bit-width
    * @param fallWithinMasks if width is a multiple of 8 or greater than 8, 
then this parameter null;
-   *                        if width<8, need this parameter to be (9-width) 
masks that are fully
-   *                        within a byte.
+   *     if width<8, need this parameter to be (9-width) masks that are fully 
within a byte.
    * @return long variable
    */
   public static long bytesToLong2(byte[] result, int pos, int width, int[] 
fallWithinMasks) {
@@ -586,35 +602,35 @@ public class BytesUtils {
     if (byteNum == 1) {
       if (endPosInByte - startPosInByte == 7) {
         // put the whole byte into the long value
-//        TsFileConstant.bytesToLong_byteNum1_wholeByte++;
+        //        TsFileConstant.bytesToLong_byteNum1_wholeByte++;
         return result[startByte] & 0xff;
       } else {
         // put bits in the byte from the global position pos to pos+width-1 
into the long value
-//        TsFileConstant.bytesToLong_byteNum1_smallByte++;
+        //        TsFileConstant.bytesToLong_byteNum1_smallByte++;
         // TODO precompute and reuse masks
         int mask = fallWithinMasks[startPosInByte];
-//        int mask = 0;
-//        if (width == 2) {
-//          switch (startPosInByte) {
-//            case 0:
-//              mask = 0b11000000;
-//              break;
-//            case 2:
-//              mask = 0b00110000;
-//              break;
-//            case 4:
-//              mask = 0b00001100;
-//              break;
-//            case 6:
-//              mask = 0b00000011;
-//              break;
-//            default:
-//              System.out.println("wrong!!!");
-//          }
-//        } else {
-//          mask = (int) Math.pow(2, 8 - width) - 1; // TODO consider if this 
to make static
-//          mask = (~mask & 0xff) >> startPosInByte;
-//        }
+        //        int mask = 0;
+        //        if (width == 2) {
+        //          switch (startPosInByte) {
+        //            case 0:
+        //              mask = 0b11000000;
+        //              break;
+        //            case 2:
+        //              mask = 0b00110000;
+        //              break;
+        //            case 4:
+        //              mask = 0b00001100;
+        //              break;
+        //            case 6:
+        //              mask = 0b00000011;
+        //              break;
+        //            default:
+        //              System.out.println("wrong!!!");
+        //          }
+        //        } else {
+        //          mask = (int) Math.pow(2, 8 - width) - 1; // TODO consider 
if this to make static
+        //          mask = (~mask & 0xff) >> startPosInByte;
+        //        }
 
         return (result[startByte] & mask) >> (7 - endPosInByte);
         // here mask is positive so no need &0xff
@@ -627,13 +643,15 @@ public class BytesUtils {
       int shift = width - (8 - startPosInByte);
       if (startPosInByte == 0) {
         // put the whole byte into the long value's front place among the last 
width bits
-//        TsFileConstant.byteToLong_byteNums_firstByte_wholeByte++;
+        //        TsFileConstant.byteToLong_byteNums_firstByte_wholeByte++;
         value = value | ((result[startByte] & 0xff) << shift);
       } else {
-        // put the bits in the first byte from relative position pos%8 to the 
end into the long value's front place among the last width bits
-//        TsFileConstant.byteToLong_byteNums_firstByte_smallByte++;
-//        int mask =
-//            (int) Math.pow(2, 8 - startPosInByte) - 1; // TODO consider if 
this to make static
+        // put the bits in the first byte from relative position pos%8 to the 
end into the long
+        // value's front place among the last width bits
+        //        TsFileConstant.byteToLong_byteNums_firstByte_smallByte++;
+        //        int mask =
+        //            (int) Math.pow(2, 8 - startPosInByte) - 1; // TODO 
consider if this to make
+        // static
         int mask = TsFileConstant.endInByteMasks[startPosInByte - 1];
         value = value | ((result[startByte] & mask) << shift);
       }
@@ -641,35 +659,38 @@ public class BytesUtils {
       // 2. deal with the last byte
       if (endPosInByte == 7) {
         // put the whole byte into the long value's back place among the last 
width bits
-//        TsFileConstant.byteToLong_byteNums_lastByte_wholeByte++;
+        //        TsFileConstant.byteToLong_byteNums_lastByte_wholeByte++;
         value = value | (result[endByte] & 0xff);
       } else {
-        // put the bits in the last byte from relative position 0 to 
(pos+width-1)%8 into the long value's back place among the last width bits
-//        TsFileConstant.byteToLong_byteNums_lastByte_smallByte++;
-//        int mask =
-//            (int) Math.pow(2, 7 - endPosInByte) - 1; // TODO consider if 
this to make static
+        // put the bits in the last byte from relative position 0 to 
(pos+width-1)%8 into the long
+        // value's back place among the last width bits
+        //        TsFileConstant.byteToLong_byteNums_lastByte_smallByte++;
+        //        int mask =
+        //            (int) Math.pow(2, 7 - endPosInByte) - 1; // TODO 
consider if this to make
+        // static
         int mask = TsFileConstant.endInByteMasks[endPosInByte];
-        value = value | ((result[endByte] & 0xff & ~mask) >> (7
-            - endPosInByte)); // here mask is negative so need &0xff
+        value =
+            value
+                | ((result[endByte] & 0xff & ~mask)
+                    >> (7 - endPosInByte)); // here mask is negative so need 
&0xff
       }
 
       // 3. deal with the middle bytes
       for (int k = startByte + 1; k < endByte; k++) {
-//        TsFileConstant.byteToLong_byteNums_middleWholeByte++;
+        //        TsFileConstant.byteToLong_byteNums_middleWholeByte++;
         shift -= 8;
         value = value | ((result[k] & 0xff) << shift);
       }
       return value;
     }
-
   }
 
   /**
    * convert eight-bytes byte array cut from parameters to long.
    *
    * @param byteNum source bytes which length should be greater than 8
-   * @param len     length of input byte array to be converted
-   * @param offset  position in parameter byte array that conversion result 
should start
+   * @param len length of input byte array to be converted
+   * @param offset position in parameter byte array that conversion result 
should start
    * @return long
    */
   public static long bytesToLongFromOffset(byte[] byteNum, int len, int 
offset) {
@@ -743,8 +764,8 @@ public class BytesUtils {
   /**
    * cut out specified length byte array from parameter start from input byte 
array src and return.
    *
-   * @param src    input byte array
-   * @param start  start index of src
+   * @param src input byte array
+   * @param start start index of src
    * @param length cut off length
    * @return byte array
    */
@@ -761,11 +782,12 @@ public class BytesUtils {
   }
 
   /**
-   * get one bit in input integer. the offset is from low to high and start 
with 0<br> e.g.<br>
+   * get one bit in input integer. the offset is from low to high and start 
with 0<br>
+   * e.g.<br>
    * data:1000(00000000 00000000 00000011 11101000), if offset is 4, return 
0(111 "0" 1000) if
    * offset is 9, return 1(00000 "1" 1 11101000).
    *
-   * @param data   input int variable
+   * @param data input int variable
    * @param offset bit offset
    * @return 0 or 1
    */
@@ -780,13 +802,14 @@ public class BytesUtils {
 
   /**
    * set one bit in input integer. the offset is from low to high and start 
with index 0<br>
-   * e.g.<br> data:1000({00000000 00000000 00000011 11101000}), if offset is 
4, value is 1, return
+   * e.g.<br>
+   * data:1000({00000000 00000000 00000011 11101000}), if offset is 4, value 
is 1, return
    * 1016({00000000 00000000 00000011 111 "1" 1000}) if offset is 9, value is 
0 return 488({00000000
    * 00000000 000000 "0" 1 11101000}) if offset is 0, value is 0 return 
1000(no change).
    *
-   * @param data   input int variable
+   * @param data input int variable
    * @param offset bit offset
-   * @param value  value to set
+   * @param value value to set
    * @return int variable
    */
   public static int setIntN(int data, int offset, int value) {
@@ -799,11 +822,12 @@ public class BytesUtils {
   }
 
   /**
-   * get one bit in input byte. the offset is from low to high and start with 
0<br> e.g.<br>
+   * get one bit in input byte. the offset is from low to high and start with 
0<br>
+   * e.g.<br>
    * data:16(00010000), if offset is 4, return 1(000 "1" 0000) if offset is 7, 
return 0("0"
    * 0010000).
    *
-   * @param data   input byte variable
+   * @param data input byte variable
    * @param offset bit offset
    * @return 0/1
    */
@@ -817,13 +841,14 @@ public class BytesUtils {
   }
 
   /**
-   * set one bit in input byte. the offset is from low to high and start with 
index 0<br> e.g.<br>
+   * set one bit in input byte. the offset is from low to high and start with 
index 0<br>
+   * e.g.<br>
    * data:16(00010000), if offset is 4, value is 0, return 0({000 "0" 0000}) 
if offset is 1, value
    * is 1, return 18({00010010}) if offset is 0, value is 0, return 16(no 
change).
    *
-   * @param data   input byte variable
+   * @param data input byte variable
    * @param offset bit offset
-   * @param value  value to set
+   * @param value value to set
    * @return byte variable
    */
   public static byte setByteN(byte data, int offset, int value) {
@@ -838,7 +863,7 @@ public class BytesUtils {
   /**
    * get one bit in input long. the offset is from low to high and start with 
0.
    *
-   * @param data   input long variable
+   * @param data input long variable
    * @param offset bit offset
    * @return 0/1
    */
@@ -854,9 +879,9 @@ public class BytesUtils {
   /**
    * set one bit in input long. the offset is from low to high and start with 
index 0.
    *
-   * @param data   input long variable
+   * @param data input long variable
    * @param offset bit offset
-   * @param value  value to set
+   * @param value value to set
    * @return long variable
    */
   public static long setLongN(long data, int offset, int value) {
@@ -932,7 +957,7 @@ public class BytesUtils {
    * read bytes specified length from InputStream safely.
    *
    * @param count number of byte to read
-   * @param in    InputStream
+   * @param in InputStream
    * @return byte array
    * @throws IOException cannot read from InputStream
    */

Reply via email to