① js转java代码
package p1;
import java.util.Arrays;
import java.util.LinkedList;
public class Guy
{
public static void recursionSub ( LinkedList<int[]> list, int count, int[] array, int ind, int start, int... indexs )
{
start++;
if (start > count - 1)
{
return;
}
if (start == 0)
{
indexs = new int[array.length];
}
for ( indexs[start] = ind; indexs[start] < array.length; indexs[start]++ )
{
recursionSub (list, count, array, indexs[start] + 1, start, indexs);
if (start == count - 1)
{
int[] temp = new int[count];
for ( int i = count - 1; i >= 0; i-- )
{
temp[start - i] = array[indexs[start - i]];
}
list.add (temp);
}
}
}
public static void main ( String[] args )
{
int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
LinkedList<int[]> list = new LinkedList<int[]> ();
recursionSub (list, 3, array, 0, -1);
for ( int[] strings : list )
{
System.out.println (Arrays.toString (strings));
}
}
}
② js正则转java正则怎么转
js正则转java:你应该是想知道js正则表达式,在java里怎么写吧。
举例:String strRegex = "^[1][3,4,5,8][0-9]{9}$";校验手机号码
String str = "13977895777";
str.matches(strRegex );