Skip to content

Commit 1db1dc7

Browse files
committed
1.38
1 parent 7d7c955 commit 1db1dc7

File tree

6 files changed

+55
-7
lines changed

6 files changed

+55
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dev.felnull.fnjl;
22

33
public class FNJLBuildIn {
4-
protected static final String VERSION = "1.37";
4+
protected static final String VERSION = "1.38";
55
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package dev.felnull.fnjl.util;
2+
3+
import java.util.function.IntConsumer;
4+
5+
/**
6+
* 繰り返し関係の処理
7+
*
8+
* @author MORIMORI0317
9+
* @since 1.38
10+
*/
11+
public class FNForUtil {
12+
/**
13+
* 少ないほうから多い数へ繰り返し
14+
*
15+
* @param start 開始
16+
* @param end 終了
17+
* @param action 実行
18+
*/
19+
public static void forMinToMax(int start, int end, IntConsumer action) {
20+
for (int i = Math.min(start, end); i < Math.max(start, end); i++) {
21+
action.accept(i);
22+
}
23+
}
24+
25+
/**
26+
* 少ないほうから多い数へ繰り返し
27+
*
28+
* @param start 開始
29+
* @param end 終了
30+
* @param action 実行
31+
*/
32+
public static void forMinToMaxDownwards(int start, int end, IntConsumer action) {
33+
for (int i = Math.min(start, end); i <= Math.max(start, end); i++) {
34+
action.accept(i);
35+
}
36+
}
37+
}

common/src/main/java/dev/felnull/fnjl/util/FNStringUtil.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,22 @@ public static String removeExtension(String name) {
102102
* @return 容量表記
103103
*/
104104
public static String getByteDisplay(long length) {
105+
return getByteDisplay(length, 1000);
106+
}
107+
108+
/**
109+
* バイト容量表記(単位付き)を取得
110+
*
111+
* @param length サイズ
112+
* @param kbCont 1KB何Byteか
113+
* @return 容量表記
114+
*/
115+
public static String getByteDisplay(long length, long kbCont) {
105116
int keta = (int) Math.floor(Math.log10(length));
106117
if (keta <= 2)
107118
return String.format("%sByte", length);
108119
int kets = keta - 2;
109-
float val = (float) ((float) length / Math.pow(1000, 1 + (int) Math.floor(((float) kets / 3))));
120+
float val = (float) ((float) length / Math.pow(kbCont, 1 + (int) Math.floor(((float) kets / 3))));
110121
return String.format("%s%sB", val, unit[(int) Math.floor(((float) kets / 3f))]);
111122
}
112123

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package dev.felnull.fnjltest;
22

3-
import dev.felnull.fnjl.math.FNVec2f;
4-
import dev.felnull.fnjl.util.FNMath;
3+
import dev.felnull.fnjl.util.FNStringUtil;
54

65
public class Main {
76
public static void main(String[] args) {
8-
System.out.println(FNMath.trans4to2CornerPlanes(new FNVec2f(0.2f, 0.1f), new FNVec2f(0.2f, 0.75f), new FNVec2f(0.8f, 0.1f), new FNVec2f(0.8f, 0.75f)));
7+
//System.out.println(FNMath.trans4to2CornerPlanes(new FNVec2f(0.2f, 0.1f), new FNVec2f(0.2f, 0.75f), new FNVec2f(0.8f, 0.1f), new FNVec2f(0.8f, 0.75f)));
98
// System.out.println(FNMath.min(1919, 810, 114514, 19, 24, 19, 810, 32));
9+
System.out.println(FNStringUtil.getByteDisplay(1024 * 1024 * 8,1024));
1010
}
1111
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fnjl_group=dev.felnull
22
fnjl_name=felnull-java-library
3-
fnjl_version=1.37
3+
fnjl_version=1.38
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.felnull.fnjln;
22

33
public class FNJLNBuildIn {
4-
protected static final String VERSION = "1.37";
4+
protected static final String VERSION = "1.38";
55

66
protected static final int NATIVE_LIBRARY_VERSION = 1;
77
}

0 commit comments

Comments
 (0)