回答編集履歴

4

テキスト修正

2018/10/22 14:38

投稿

jun68ykt
jun68ykt

スコア9058

test CHANGED
File without changes

3

テキスト修正

2018/10/22 14:38

投稿

jun68ykt
jun68ykt

スコア9058

test CHANGED
@@ -98,4 +98,4 @@
98
98
 
99
99
 
100
100
 
101
- - [https://www.jdoodle.com/a/Kc4](https://www.jdoodle.com/a/Kc4)
101
+ - **動作確認用サンプル: ** [https://www.jdoodle.com/a/Kc4](https://www.jdoodle.com/a/Kc4)

2

テキスト修正

2018/10/22 14:37

投稿

jun68ykt
jun68ykt

スコア9058

test CHANGED
@@ -69,3 +69,33 @@
69
69
 
70
70
 
71
71
  一番左の[Execute]ボタンをクリックすると実行されます。(jdoodleだと日本語の文字列は化けるようです。)
72
+
73
+
74
+
75
+ #### 追記
76
+
77
+
78
+
79
+ 正規表現でやるとすれば、Oreilly [Regular Expressions Cookbook](http://shop.oreilly.com/product/0636920023630.do) の
80
+
81
+ - [6.7. Numbers Within a Certain Range](https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch06s07.html)
82
+
83
+
84
+
85
+ に載っている、以下を使うのがよいかと思います。
86
+
87
+
88
+
89
+ > –128 to 127 (signed byte):
90
+
91
+ >
92
+
93
+ > ^(12[0-7]|1[01][0-9]|[1-9]?[0-9]|-(12[0-8]|1[01][0-9]|[1-9]?[0-9]))$
94
+
95
+
96
+
97
+ 以下は、上記の正規表現にマッチする文字列を判定するコード例です。
98
+
99
+
100
+
101
+ - [https://www.jdoodle.com/a/Kc4](https://www.jdoodle.com/a/Kc4)

1

テキスト修正

2018/10/22 14:34

投稿

jun68ykt
jun68ykt

スコア9058

test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- String[] data = { "101", "ajt", "あああ", "121", "-1", "256" };
29
+ String[] data = { "101", "ajt", "あああ", "121", "-1", "128" };
30
30
 
31
31
  List<Byte> byteValues = new ArrayList<>();
32
32