diff --git a/src/main/java/com/loafle/overflow/commons/utils/StringConvertor.java b/src/main/java/com/loafle/overflow/commons/utils/StringConvertor.java new file mode 100644 index 0000000..42197f1 --- /dev/null +++ b/src/main/java/com/loafle/overflow/commons/utils/StringConvertor.java @@ -0,0 +1,15 @@ +package com.loafle.overflow.commons.utils; + +/** + * Created by snoop on 17. 8. 23. + */ +public class StringConvertor { + + public static String intToIp(long i) { + return ((i >> 24 ) & 0xFF) + "." + + ((i >> 16 ) & 0xFF) + "." + + ((i >> 8 ) & 0xFF) + "." + + ( i & 0xFF); + } + +} diff --git a/src/test/java/com/loafle/overflow/commons/utils/StringConvertorTest.java b/src/test/java/com/loafle/overflow/commons/utils/StringConvertorTest.java new file mode 100644 index 0000000..a159503 --- /dev/null +++ b/src/test/java/com/loafle/overflow/commons/utils/StringConvertorTest.java @@ -0,0 +1,17 @@ +package com.loafle.overflow.commons.utils; + +import org.junit.Test; + +/** + * Created by snoop on 17. 8. 23. + */ +public class StringConvertorTest { + @Test + public void intToIp() throws Exception { + + String ipStr = StringConvertor.intToIp(3232235797L); + + System.out.println(ipStr); + } + +} \ No newline at end of file