我正在用Python测试大整数;它们被实现为带有符号和数字数组的对象。基本上是描述Karatsuba乘法,对于那些大整数,我需要具有与storageRef = FirebaseStorage.getInstance().getReference("posts");
close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(PostActivity.this, MainActivity.class));
finish();
}
});
post.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
uploadImage_10();
}
});
CropImage.activity()
.start(PostActivity.this);
}
private String getFileExtension(Uri uri){
ContentResolver cR = getContentResolver();
MimeTypeMap mime = MimeTypeMap.getSingleton();
return mime.getExtensionFromMimeType(cR.getType(uri));
}
private void uploadImage_10(){
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage("Posting");
pd.show();
if (mImageUri != null){
final StorageReference fileReference = storageRef.child(System.currentTimeMillis()
+ "." + getFileExtension(mImageUri));
uploadTask = fileReference.putFile(mImageUri);
uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
if (!task.isSuccessful()) {
throw task.getException();
}
return fileReference.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
if (task.isSuccessful()) {
Uri downloadUri = task.getResult();
miUrlOk = downloadUri.toString();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Posts");
String postid = reference.push().getKey();
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("postid", postid);
hashMap.put("postimage", miUrlOk);
hashMap.put("description", description.getText().toString());
hashMap.put("publisher", FirebaseAuth.getInstance().getCurrentUser().getUid());
reference.child(postid).setValue(hashMap);
pd.dismiss();
startActivity(new Intent(PostActivity.this, MainActivity.class));
finish();
} else {
Toast.makeText(PostActivity.this, "Failed", Toast.LENGTH_SHORT).show();
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(PostActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
} else {
Toast.makeText(PostActivity.this, "No image selected", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) {
CropImage.ActivityResult result = CropImage.getActivityResult(data);
mImageUri = result.getUri();
image_added.setImageURI(mImageUri);
} else {
Toast.LENGTH_SHORT).show();
startActivity(new Intent(PostActivity.this, MainActivity.class));
finish();
}
}
进行整数除的普通数字相同的行为,并且存在一个问题:
为什么在Python中使用10
?
答案 0 :(得分:1)
除以//
是下限。
底数除以.
到较低的数字
22 // 10
产生下一个较低的值2
。
-22 // 10
产生下一个较低的值-3
要进行常规除法,您可以运行 -22 / 10 导致
- 2.2