Commit ae30b5f5 authored by zhouleilei's avatar zhouleilei

计划调度工具类优化

parent 74141e44
...@@ -13,12 +13,12 @@ public class ScheduleUtil { ...@@ -13,12 +13,12 @@ public class ScheduleUtil {
* @Param value * @Param value
* @Param type 1-月 2-日 3-星期 * @Param type 1-月 2-日 3-星期
**/ **/
public static String getSchedule(Integer value, Integer type) { public static String getSchedule(Long value, Integer type) {
if (value == null || type == null){ if (value == null || type == null){
return ""; return "";
} }
//将int转为二进制 //将int转为二进制
String binary = Integer.toBinaryString(value); String binary = Long.toBinaryString(value);
StringBuilder stringBuilder = new StringBuilder(binary); StringBuilder stringBuilder = new StringBuilder(binary);
String s = stringBuilder.reverse().toString(); String s = stringBuilder.reverse().toString();
int len = s.length(); int len = s.length();
...@@ -101,8 +101,8 @@ public class ScheduleUtil { ...@@ -101,8 +101,8 @@ public class ScheduleUtil {
} }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(getSchedule(8190, 1)); System.out.println(getSchedule(512L, 1));
System.out.println(getSchedule(0, 2)); System.out.println(getSchedule(4294967295L, 2));
System.out.println(getSchedule(4, 3)); System.out.println(getSchedule(1L, 3));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment