You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2020/06/23 20:47:20 UTC
[commons-net] branch master updated: Localise methods
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
The following commit(s) were added to refs/heads/master by this push:
new 33ee6fc Localise methods
33ee6fc is described below
commit 33ee6fca1ffb11aa93afd064ee3e5c00a72c1548
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jun 23 21:47:12 2020 +0100
Localise methods
---
.../org/apache/commons/net/util/SubnetUtils.java | 50 +++++++++++-----------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/main/java/org/apache/commons/net/util/SubnetUtils.java b/src/main/java/org/apache/commons/net/util/SubnetUtils.java
index 9a22ade..d14379e 100644
--- a/src/main/java/org/apache/commons/net/util/SubnetUtils.java
+++ b/src/main/java/org/apache/commons/net/util/SubnetUtils.java
@@ -273,6 +273,31 @@ public class SubnetUtils {
return addresses;
}
+ /*
+ * Convert a packed integer address into a 4-element array
+ */
+ private int[] toArray(int val) {
+ int ret[] = new int[4];
+ for (int j = 3; j >= 0; --j) {
+ ret[j] |= ((val >>> 8*(3-j)) & (0xff));
+ }
+ return ret;
+ }
+
+ /*
+ * Convert a 4-element array into dotted decimal format
+ */
+ private String format(int[] octets) {
+ StringBuilder str = new StringBuilder();
+ for (int i =0; i < octets.length; ++i){
+ str.append(octets[i]);
+ if (i != octets.length - 1) {
+ str.append(".");
+ }
+ }
+ return str.toString();
+ }
+
/**
* {@inheritDoc}
* @since 2.2
@@ -323,31 +348,6 @@ public class SubnetUtils {
}
/*
- * Convert a packed integer address into a 4-element array
- */
- private int[] toArray(int val) {
- int ret[] = new int[4];
- for (int j = 3; j >= 0; --j) {
- ret[j] |= ((val >>> 8*(3-j)) & (0xff));
- }
- return ret;
- }
-
- /*
- * Convert a 4-element array into dotted decimal format
- */
- private String format(int[] octets) {
- StringBuilder str = new StringBuilder();
- for (int i =0; i < octets.length; ++i){
- str.append(octets[i]);
- if (i != octets.length - 1) {
- str.append(".");
- }
- }
- return str.toString();
- }
-
- /*
* Convenience function to check integer boundaries.
* Checks if a value x is in the range [begin,end].
* Returns x if it is in range, throws an exception otherwise.