This commit is contained in:
Administrator
2024-08-18 17:47:11 +08:00
parent e4f4c77c19
commit e243203535
121 changed files with 7499 additions and 2169 deletions
@@ -13,7 +13,9 @@ public class KLALBUtils {
ByteArrayOutputStream bos=new ByteArrayOutputStream(8);
DataOutputStream dos=new DataOutputStream(bos);
try {
dos.writeLong(uuid.getMostSignificantBits());
long l=uuid.getMostSignificantBits();
l=(l&0x0000FFFFFFFFFFFFL)|0x2486000000000000L;
dos.writeLong(l);
dos.writeLong(uuid.getLeastSignificantBits());
dos.close();} catch (IOException e) {
// TODO 自动生成的 catch 块
@@ -31,6 +33,21 @@ public class KLALBUtils {
System.out.println(uuidToIP(new UUID(-1,-1)));
}
public static String bytesUnit(long v) {
if (v >= 1024L * 1024 * 1024 * 1024 * 1024) {
return String.format("%.1f", v / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)) + "PB";
} else if (v >= 1024L * 1024 * 1024 * 1024) {
return String.format("%.1f", v / (1024.0 * 1024.0 * 1024.0 * 1024.0)) + "TB";
} else if (v >= 1024L * 1024 * 1024) {
return String.format("%.1f", v / (1024.0 * 1024.0 * 1024.0)) + "GB";
} else if (v >= 1024L * 1024) {
return String.format("%.1f", v / (1024.0 * 1024.0)) + "MB";
} else if (v >= 1024L) {
return String.format("%.1f", v / (1024.0)) + "KB";
} else {
return v + "B";
}
}
public static String bytesUnitSimp(long v) {
if(v>=1024L*1024*1024*1024*1024) {
return format( v/(1024.0*1024.0*1024.0*1024.0*1024.0))+"P";
}else if(v>=1024L*1024*1024*1024) {