npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

autojs-create-javaarray

v0.1.2

Published

Autojs Pro V9的创建Java类型数组。

Downloads

8

Readme

autojs-create-javaarray

目前Autojs Pro V9的nodejs模式还没有创建Java类型数组的封装,于是我自己写了一个。 由于个人技术问题,代码写的可能不怎么好看,请见谅。

反馈方式

QQ:2682963017

快速开始

1. 安装

npm install autojs-create-javaarray

2. 引入

CJS:

var $JavaArray = require("autojs-create-javaarray");

ESM:

import $JavaArray from "autojs-create-javaarray";

3. 示例与说明

一:

var class_array;

//使用fromTypeAndLength方法创建长度为5的空float数组
class_array = $JavaArray.fromTypeAndLength("float", 5);
//赋值前两位元素
class_array[0] = 180;
class_array[1] = 1.378;
//打印数组本身与长度
console.log(class_array, class_array.length);
//循环打印数组元素
for (let i = 0; i < class_array.length; i++){
    console.log(class_array[i]);
}

二:

//使用fromArray自动识别类型与长度,创建类型数组与填充
class_array = $JavaArray.fromArray([
    1.0,
    2.6,
    7.9
]);
/*
*fromArgs与fromArray功能一致,但不需要在元素外套一个数组
*class_array = $JavaArray.fromArray(1.0, 2.6, 7.9);
*/
//打印数组本身与长度
console.log(class_array, class_array.length);
//循环打印数组元素
for (let i = 0; i < class_array.length; i++){
    console.log(class_array[i]);
}

三:

/*
*js中的部分原始类型会自动转换为java原始类型或类实例
*布尔值: boolean,整数: int,浮点数: double,字符串: java.lang.String
*由于js中无法分辨1.0与1的区别,所以1.0会被识别为int类型
*类似的情况下可以使用fromTypeAndArray与fromTypeAndArgs手动指定类型
*/
class_array = $JavaArray.fromTypeAndArray("float", [
    1.0,
    2.6,
    7.9
]);

//打印数组本身与长度
console.log(class_array, class_array.length);
//循环打印数组元素
for (let i = 0; i < class_array.length; i++){
    console.log(class_array[i]);
}

四:

/*
*fromTypeAndLength、fromTypeAndArray与fromTypeAndArgs的首位参数可为以下内容:
*java原始类型字符串: "boolean", "int", "long", "double", "char", "byte", float"
*java类或类名: java.lang.String, "java.io.File"
*java类实例: new java.lang.StringBuffer()
*js部分原始类型值: 布尔值: boolean,整数: int,浮点数: double,字符串: java.lang.String
*/
class_array = $JavaArray.fromTypeAndLength("int", 5);
//打印数组本身与长度
console.log(class_array, class_array.length);

class_array = $JavaArray.fromTypeAndLength(java.lang.String, 5);
//打印数组本身与长度
console.log(class_array, class_array.length);

class_array = $JavaArray.fromTypeAndLength("java.io.File", 5);
//打印数组本身与长度
console.log(class_array, class_array.length);

class_array = $JavaArray.fromTypeAndLength(new java.lang.StringBuffer(), 5);
//打印数组本身与长度
console.log(class_array, class_array.length);

五:

//多维数组的创建
class_array = $JavaArray.fromTypeAndLength("int", [1, 2]);
//打印数组本身与长度
console.log(class_array, class_array.length);

class_array = $JavaArray.fromArray("float", [
    [1, 150]
]);
//打印数组本身与长度
console.log(class_array, class_array.length);

class_array = $JavaArray.fromTypeAndArgs("float", [1, 150]);
//打印数组本身与长度
console.log(class_array, class_array.length);

API

不会写,暂略,请参考示例中的注释。。。