File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
src/main/java/com/github/myibu/algorithm/data Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
2626
2727group = ' com.github.myibu'
2828archivesBaseName = " algorithm-java"
29- version = " 1.0.0f "
29+ version = " 1.0.0g "
3030
3131repositories {
3232 mavenCentral()
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ Reference to: [HoffmanAndGolombCoding.pdf](./docs/HoffmanAndGolombCoding.pdf)
5757< dependency>
5858 < groupId> com.github.myibu< /groupId>
5959 < artifactId> algorithm-java< /artifactId>
60- < version> 1.0.0f < /version>
60+ < version> 1.0.0g < /version>
6161< /dependency>
6262```
6363
Original file line number Diff line number Diff line change @@ -273,6 +273,7 @@ public static Bits ofByte(byte val, int len) {
273273 }
274274
275275 public static Bits ofByte (byte [] val ) {
276+ if (val == null || val .length == 0 ) return new Bits ();
276277 int i = 0 ;
277278 Bits first = ofByte (val [i ++]);
278279 for (; i < val .length ; i ++) {
@@ -300,6 +301,7 @@ public static Bits ofShort(short val, int len) {
300301 }
301302
302303 public static Bits ofShort (short [] val ) {
304+ if (val == null || val .length == 0 ) return new Bits ();
303305 int i = 0 ;
304306 Bits first = ofShort (val [i ++]);
305307 for (; i < val .length ; i ++) {
@@ -327,6 +329,7 @@ public static Bits ofInt(int val, int len) {
327329 }
328330
329331 public static Bits ofInt (int [] val ) {
332+ if (val == null || val .length == 0 ) return new Bits ();
330333 int i = 0 ;
331334 Bits first = ofInt (val [i ++]);
332335 for (; i < val .length ; i ++) {
@@ -406,6 +409,7 @@ public static Bits ofLong(long val, int len) {
406409 }
407410
408411 public static Bits ofLong (long [] val ) {
412+ if (val == null || val .length == 0 ) return new Bits ();
409413 int i = 0 ;
410414 Bits first = ofLong (val [i ++]);
411415 for (; i < val .length ; i ++) {
You can’t perform that action at this time.
0 commit comments